iOS 按钮上的文字添加下划线的方法
更新时间:2016年05月04日 10:58:27 作者:wusang
这篇文章主要介绍了iOS 按钮上的文字添加下划线的方法的相关资料,需要的朋友可以参考下
问题:实现下图中右侧的按钮文字效果
方法:
[MyTools createMyImageview:topEditView frame:CGRectMake(widthAll-90, 12, 17, 16) imageName:@"离线课程_下载更多.png"]; UIButton *downMoreButton = [MyTools createMyBtn:@"下载更多" frame:CGRectMake(widthAll-70, 10, 60, 20) uiview:topEditView uifont:14 color:[UIColor colorWithRed:92/255.0 green:218/255.0 blue:231/255.0 alpha:1]]; NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:@"下载更多"]; NSRange titleRange = {0,[title length]}; [title addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:titleRange]; [downMoreButton setAttributedTitle:title forState:UIControlStateNormal]; [downMoreButton.titleLabel setFont:[UIFont systemFontOfSize:14]]; [downMoreButton addTarget:self action:@selector(downMore) forControlEvents:UIControlEventTouchUpInside];
关于iOS 按钮上的文字添加下划线的方法就给大家介绍到这里,希望对大家有所帮助!
相关文章
iOS使用WKWebView加载HTML5不显示屏幕宽度的问题解决
这篇文章主要介绍了iOS使用WKWebView加载HTML5不显示屏幕宽度的问题解决,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-12-12IOS MenuViewController实现弹出菜单效果
这篇文章主要介绍了IOS MenuViewController实现弹出菜单效果,实现一个从下移动上来的弹出菜单,背景逐渐变深,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2017-07-07iOS开发之UIKeyboardTypeNumberPad数字键盘自定义按键
这篇文章主要介绍了iOS开发之UIKeyboardTypeNumberPad数字键盘自定义按键 的相关资料,需要的朋友可以参考下2016-08-08iOS开发Quick Actions创建桌面Icon快捷方式
在本文里我们给大家分享了关于iOS开发Quick Actions创建桌面Icon快捷方式的相关知识点内容,需要的读者们可以参考下。2019-05-05
最新评论