2017-09-24 20 views
0

我有一些麻烦(错误:方法不覆盖任何方法从它的超类)重写UIVC方法,我做错了什么?UIVIevController覆盖

代码示例与supportedInterfaceOrientation,它不会导致错误,但仍然不重写和不工作。

func supportedInterfaceOrientations() -> UIInterfaceOrientationMask{ 
return UIInterfaceOrientationMask(rawValue:(UIInterfaceOrientationMask.portrait.rawValue | UIInterfaceOrientationMask.landscape.rawValue))} 

截图问题 enter image description here

回答

0

Xcode的方法有变化的新版本。现在它是一个可以覆盖的变量。

@available(iOS 6.0, *) 
open var supportedInterfaceOrientations: UIInterfaceOrientationMask { get } 
0

这是一个属性。 Swift覆盖:

override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 
    get { 
     return UIInterfaceOrientationMask.all 
    } 
}