gpt4 book ai didi

ios - 屏幕旋转时ReloadData()

转载 作者:搜寻专家 更新时间:2023-10-31 22:03:34 25 4
gpt4 key购买 nike

当您转动我的设备屏幕时,我无法更新我的自定义 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com