iOS 按钮上的文字添加下划线的方法
程序员文章站
2023-11-30 23:35:04
问题:实现下图中右侧的按钮文字效果
方法:
[mytools createmyimageview:topeditview frame:cgrectmak...
问题:实现下图中右侧的按钮文字效果
方法:
[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 按钮上的文字添加下划线的方法就给大家介绍到这里,希望对大家有所帮助!