ios - iPhone SE 中按钮不显示全文

标签 ios swift uibutton autolayout

我在 View 中有3个按钮。所有按钮都显示具有相同行数的按钮标题。即,如果1按钮显示两行文本,则其他两行将显示相同的文本。这个问题主要在使用 iPhone SE 时影响我。它显示如下,

Button design

这就是属性检查器的外观

enter image description here

字体大小为 -

enter image description here

最佳答案

这样做,

  1. 创建从按钮 Controller IBOutlet连接。
  2. 例如:认为您的按钮 socket 名称是 -> testButton
  3. 然后在viewdidload中:

           testButton.setTitle("Delete\n Tender", for: .normal)
           testButton.titleLabel?.numberOfLines = 2
    

希望这对您有帮助。

关于ios - iPhone SE 中按钮不显示全文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47454362/

相关文章:

swift - 分配给 NSMenuItem 的操作似乎不起作用

ios - 使用 Quartz2D 删除笔划路径不仅仅是删除路径

swift - 想要在新行中打印数据

ios - 使标题成为 UIButton 中可点击区域的一部分

ios - 如何一次将多个图像传递给其他 View ?

ios - 如何检测有人经过信标

ios - 在 NativeScript 中使用 NSURLIsExcludedFromBackupKey

ios - 突然无法在iPhone模拟器上运行应用程序

ios - 如何使用 Yelp 数据和放置 Pin 图 (Swift)

ios - 突出显示时 UIButton 周围不需要的不可见检测区域