问题:实现下图中右侧的按钮文字效果
方法:
[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:titleforState:UIControlStateNormal];[downMoreButton.titleLabel setFont:[UIFont systemFontOfSize:14]];[downMoreButton addTarget:self action:@selector(downMore) forControlEvents:UIControlEventTouchUpInside];
关于iOS 按钮上的文字添加下划线的方法就给大家介绍到这里,希望对大家有所帮助!
零七网部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与零七网进行文章共享合作。