【问题标题】:Set UIButton width 0 when no title with AutoLayout没有标题时使用 AutoLayout 设置 UIButton 宽度 0
【发布时间】:2016-01-09 01:16:57
【问题描述】:

我需要动态设置 UIButton 标题并且它的宽度适合它的内容, 但是当我用 @"" 或 nil 字符串设置标题时,它的宽度仍然不是零,看起来大约是 30 pt。

我曾尝试在 Storyboard 和 sizeToFit 方法中将其 Intrinsic Size Placeholder 设置为 0,但均无效。

【问题讨论】:

    标签: ios objective-c iphone xcode autolayout


    【解决方案1】:

    您可以从以下链接获得答案并应用任何解决方案。

    iOS: UIButton resize according to text length

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-30
      • 2019-04-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-04
      • 2014-04-22
      • 2016-04-07
      相关资源
      最近更新 更多