我的storyboard笔尖中有一个名为titleLabel
的UILabel
设置为默认高度.我希望它能在高度上扩展以适应它的内容.以下是我迄今为止try 过的:
// just setting content
titleLabel.text = "You don't always know what you are getting with mass-market cloud computing services. But with SimpliCompute, the picture is clear. SimpliCompute gives you powerful virtual servers you can deploy using just your web browser. That’s enterprise grade technology you can deploy and control on-the-fly."
titleLabel.numberOfLines = 0
titleLabel.preferredMaxLayoutWidth = 700
titleLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping
titleLabel.sizeToFit()
这一切对我都不管用!我总是在我的UILabel
字里只看到一行文字.我做错了什么?
我绝对需要的文本内容是可变的.