当您转动我的设备屏幕时,我无法更新我的自定义 View 。
我试着这样做:
override func viewDidLoad() {
super.viewDidLoad()
var myCustomView = Customview()
self.view.addsubview(myCustomView)
}
}
override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {
// Reload Data here
self.view.reloadData() // Incorrect
}
但是让我出错:
方法“UIView”没有名为 reloadData 的方法
最佳答案
override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {
// Reload Data here
self.view.reloadData() // Incorrect
}
UIView
不是 UITableView
它没有开箱即用的 reloadData
方法。
您可以手动实现此方法 -> 玩得开心 :)
关于ios - 屏幕旋转时ReloadData(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28046834/