手机
当前位置:查字典教程网 >编程开发 >IOS开发 >iOS 按钮上的文字添加下划线的方法
iOS 按钮上的文字添加下划线的方法
摘要:问题:实现下图中右侧的按钮文字效果方法:[MyToolscreateMyImageview:topEditViewframe:CGRectM...

问题:实现下图中右侧的按钮文字效果

iOS 按钮上的文字添加下划线的方法1

方法:

[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 按钮上的文字添加下划线的方法】相关文章:

IOS获取各种文件目录路径的方法

iOS保存App中的照片到系统相册或自建相册的方法

IOS关闭键盘的方法

iOS开发中使用cocos2d添加触摸事件的方法

iOS开发中实现hook消息机制的方法探究

iOS开发中CAlayer层的属性以及自定义层的方法

iOS开发中UISwitch按钮的使用方法简介

IOS设备上给body绑定click事件不生效的原因及解决办法

ios的文件加载和保存

iphone的safari浏览器中实现全屏浏览的方法

精品推荐
分类导航