下划线按钮标题​​ xcode

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13380670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:05:30  来源:igfitidea点击:

Underlining button title xcode

iphoneobjective-ciosxcodeuibutton

提问by user1700171

Possible Duplicate:
iPhone: How to Display Underlined Text in a Button?
underline text in UIlabel

可能的重复:
iPhone:如何在按钮中显示带下划线的文本?
UIlabel 中的下划线文本

I have a section im my app like this...Not a member? Signup here, where here is a custom button of transparent background and upon clicking takes the user to a url in safari. Now what i need is i want to make this button title underlined so that it looks like a hyperlink. Thanks

我有一个像这样的应用程序部分...不是会员?在这里注册,这里是一个透明背景的自定义按钮,点击后会将用户带到 safari 中的 url。现在我需要的是我想让这个按钮标题加下划线,使它看起来像一个超链接。谢谢

采纳答案by HackyStack

If the button title will be static, the easiest way is probably to create an image of the text (underlined) and use the image as the button image on a custom button.

如果按钮标题是静态的,最简单的方法可能是创建文本图像(带下划线)并将图像用作自定义按钮上的按钮图像。

回答by Dave

You can set a custom label for titleLabel in the UIButton and create underline in the custom UILabel: Underline text in UIlabel

您可以在 UIButton 中为 titleLabel 设置自定义标签,并在自定义 UILabel 中创建下划线: UIlabel 中的下划线文本