iOS 按鈕上的文字添加下劃線的方法
更新時間:2016年05月04日 10:58:27 作者:wusang
這篇文章主要介紹了iOS 按鈕上的文字添加下劃線的方法的相關資料,需要的朋友可以參考下
問題:實現(xiàn)下圖中右側的按鈕文字效果

方法:
[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基于UIScrollView實現(xiàn)滑動引導頁
這篇文章主要為大家詳細介紹了iOS基于UIScrollView實現(xiàn)滑動引導頁的相關資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01
iOS開發(fā)中Date Picker和UITool Bar控件的使用簡介
這篇文章主要介紹了iOS開發(fā)中Date Picker和UITool Bar控件的使用簡介,代碼基于傳統(tǒng)的Objective-C,需要的朋友可以參考下2016-01-01

