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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

wusang   2021-03-22 我要评论
想了解iOS 按钮上的文字添加下划线的方法的相关内容吗,wusang在本文为您仔细讲解ios 按钮文字下划线的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:ios按钮文字下划线,ios按钮下划线,ios文字下划线,下面大家一起来学习吧。

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

方法:

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

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们