为什么 shouldAutorotateToInterfaceOrientation 方法标记为不可用?
Why shouldAutorotateToInterfaceOrientation method marked as unavailable?
我把这段代码放到 UIViewController
子类中:
override func shouldAutorotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation) -> Bool {
return true
}
我得到这个编译时错误:
Cannot override 'shouldAutorotateToInterfaceOrientation' which has been marked unavailable
这是什么问题,我该如何解决?
shouldAutorotateToInterfaceOrientation
已弃用 尝试使用 shouldAutorotate()
使用此代码 -
override var shouldAutorotate: Bool {
return true
}
希望对您有所帮助!
我只是更改了这段代码
shouldAutorotateToInterfaceOrientation
到此代码
shouldAutorotate
我把这段代码放到 UIViewController
子类中:
override func shouldAutorotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation) -> Bool {
return true
}
我得到这个编译时错误:
Cannot override 'shouldAutorotateToInterfaceOrientation' which has been marked unavailable
这是什么问题,我该如何解决?
shouldAutorotateToInterfaceOrientation
已弃用 尝试使用 shouldAutorotate()
使用此代码 -
override var shouldAutorotate: Bool {
return true
}
希望对您有所帮助!
我只是更改了这段代码
shouldAutorotateToInterfaceOrientation
到此代码
shouldAutorotate