#pragma mark -- 底部的客服电话提醒
- (void)createHintView
{
UIImage *_image = loadBundleImageWithName(@"tips");
UIImageView *_imageView = [[UIImageView alloc]init];
[_imageView setFrame:CGRectMake(12, CGRectGetMaxY(self.walletPayView.frame) + 20, _image.size.width, _image.size.height)];
_imageView.image = _image;
[self.view addSubview:_imageView];
NSMutableParagraphStyle * paragraphStyle = [NSMutableParagraphStyle new];
//调整行间距
paragraphStyle.lineSpacing= 6;
NSDictionary*attriDict =@{NSParagraphStyleAttributeName:paragraphStyle};
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"有支付权限的用户,请改用安卓手机使用白条支付功能。如有疑问请联系客户热线:400-866-5566" attributes:attriDict];
[attributedString addAttribute:NSFontAttributeName value:loadFont(12) range:NSMakeRange(0, attributedString.length)];
[attributedString addAttribute:NSLinkAttributeName
value:@"tel://"
range:[[attributedString string] rangeOfString:@"400-888-5566"]];
[attributedString addAttribute:NSForegroundColorAttributeName value:TFCOLOR_0093FF range:[[attributedString string] rangeOfString:@"400-888-5566"]];
[attributedString addAttribute:NSForegroundColorAttributeName value:TFCOLOR_68758E range:[[attributedString string] rangeOfString:@"有支付权限的用户,请改用安卓手机使用白条支付功能。如有疑问请联系客户热线:"]];
UITextView *_textview = [[UITextView alloc]init];
_textview.backgroundColor = [UIColor clearColor];
[_textview setFrame:CGRectMake(CGRectGetMaxX(_imageView.frame) + 3, CGRectGetMaxY(self.walletPayView.frame) + 10, kDEVICEWIDTH - 40, 80)];
_textview.attributedText = attributedString;
_textview.delegate = self; //不要忘记添加代理
_textview.editable = NO;
_textview.scrollEnabled = NO;
[self.view addSubview:_textview];
}
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange {
if ([[URL scheme] isEqualToString:@"tel"]) {
[self telClicked];
return NO;
}
return YES;
}
#pragma mark -- clicked method
- (void)telClicked
{
LJAlertNode *alert = [[LJAlertNode alloc] initWithMessage:@"每天00:00-24:00,我们竭诚为您服务" sureTitle:@"确认拨打" cancelTitle:@"取消" sureAction:^{
[CHUtil chTeleButtonPressed:LJServiceTeleNumber];
} cancelAction:^{
}];
[alert show];
}
ios 可点击的富文本
最新推荐文章于 2024-03-27 16:03:02 发布