在故事板中为UILabel属性字符串添加下划线失败 [英] Adding underline to UILabel attributed string from the storyboard fails

查看:651
本文介绍了在故事板中为UILabel属性字符串添加下划线失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 从故事板中选择有问题的UILabel

  2. 然后在属性检查器>标签> [我选择]归属

  3. 同样在属性检查器>标签>文字> [我选择内容]

  4. 然后我点击字体图标并选择下划线

  1. From the storyboard I select the UILabel in question
  2. Then in Attribute Inspector > Label > [I choose] Attributed
  3. Also in Attribute Inspector > Label > Text> [I select the content]
  4. Then I click on the font icon and choose underline

基本上,我从弹出的字体窗口中选择的任何更改都不会生效。

Basically, any change that I select from the Fonts window that pops up does not take effect.

有没有人成功地从故事板添加下划线?

Has anyone ever successfully add underline from the storyboard?

注意:我已经知道如何在码。我想避免添加代码。

Note: I already know how to do this in code. I want to avoid adding code.

推荐答案

这是故事板中的解决方案:
打开属性检查器(确保选择标签),将下拉值从普通更改为已归属。现在,在标签的字体下可以看到一个小文本编辑器。选择标签的文本,右键单击并将字体更改为下划线。

Here is the solution in storyboard: Open the Attribute Inspector (make sure label is selected), Change the dropdown value from 'Plain' to 'Attributed'. Now a a small text editor will be visible under the font of the label. Select the text of the label, right click and change the font to 'underline'.

我还附上了截图,并在XCode 7.0中使用故事板成功地为文本加下划线。 1

I also have attached a screenshot and successfully underlined a text using storyboard in XCode 7.0.1

这篇关于在故事板中为UILabel属性字符串添加下划线失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆