UITextView*jladyisnseTextbutView = [[UITextViewalloc]initWithFrame:CGRectMake(30,TransHeight/4*3-50,TransWidth-60,80)];
jladyisnseTextbutView.editable=NO;
jladyisnseTextbutView.backgroundColor= [UIColorclearColor];
jladyisnseTextbutView.delegate=self;
jladyisnseTextbutView.textContainer.lineFragmentPadding = 0.0;
jladyisnseTextbutView.textContainerInset=UIEdgeInsetsMake(15,0,0,0);
//点击字体的颜色
jladyisnseTextbutView.linkTextAttributes = @{NSForegroundColorAttributeName:[UIColor blueColor]};
[self.viewaddSubview:jladyisnseTextbutView];
//富文本添加
NSString*fuwenyiseString =@"点击事项";
NSString *resuitextTring = [NSString stringWithFormat:@"同意并接受我们的%@",fuwenyiseString];
NSRangediaNbuttonRange = [resuitextTringrangeOfString:fuwenyiseString];
// 字体的行间距
NSMutableParagraphStyle *hangjuTextStyle = [[NSMutableParagraphStyle alloc] init];
hangjuTextStyle.lineSpacing=4;
//数组
NSMutableAttributedString *fisymnaiNuttauBurString = [[NSMutableAttributedString alloc] initWithString:resuitextTring attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:15.0],NSForegroundColorAttributeName:[UIColor whiteColor],NSParagraphStyleAttributeName:hangjuTextStyle}];
//可点击字体的范围设置
[fisymnaiNuttauBurStringaddAttribute:NSLinkAttributeNamevalue:@"privacy://"range:diaNbuttonRange];
jladyisnseTextbutView.attributedText= fisymnaiNuttauBurString;
#pragma mark - UITextViewDelegate
-(BOOL)textView:(UITextView*)textViewshouldInteractWithURL:(NSURL*)URLinRange:(NSRange)characterRange{
if ([URL.scheme isEqualToString:@"privacy"]) {
//点击需要跳转的页面
returnNO;
}
return YES;
}