我使用长标题文本向View添加了一个RefreshControl,但这个标题隐藏了一些字。
override func viewDidLoad()
{
super.viewDidLoad()
self.refreshControl = UIRefreshControl()
self.refreshControl.attributedTitle = NSAttributedString(string: "Last Updated at Some time...Pull to refersh your content")
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
self.tableView.addSubview(refreshControl)
}
答案 0 :(得分:3)
您需要找到UIRefreshControl的UILabel并将行数设置为0以允许多行。之后,您可以添加\n
来设置换行符。 (我没有测试这段代码。检查获取UILabel的方法是否正确。也许你必须改变它。我稍后会更新它)
var titleLabel = self.refreshControl.subviews.firstObject.subviews.lastObject
if(titleLabel != nil){
titleLabel.numberOfLines = 0
var title = "Last Updated at Some time... \nPull to refersh your content"
self.refreshControl.attributedTitle = NSAttributedString(string: title)
}