有没有办法让多行文本在UILabel中,UITextView或者我应该使用第二行?
我有一个UILabel名为titleLabel我的故事板的笔尖被设置为默认的高度.我希望它以编程方式扩展以适应它的内容.这是我到目前为止所尝试的:
// 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()
Run Code Online (Sandbox Code Playgroud)
这对我来说无论如何都不适合!我总是只看到一行文字UILabel.我究竟做错了什么?
我绝对需要文本内容可变.