当前位置: 移动技术网 > 移动技术>移动开发>IOS > iOS 按钮上的文字添加下划线的方法

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

2019年07月24日  | 移动技术网移动技术  | 我要评论

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

方法:

[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 按钮上的文字添加下划线的方法就给大家介绍到这里,希望对大家有所帮助!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网