2017-09-24 6 views
0

私はいくつかのトラブルがあります(エラー:メソッドはそのスーパークラスのメソッドをオーバーライドしません)オーバーライドUIVCメソッドで、私は間違っていますか?UIVIevControllerオーバーライド

supportedInterfaceOrientationを使用したコード例ですが、エラーは発生しませんが、まだ上書きされず、動作しません。

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

スクリーンショット問題 enter image description here

答えて

0

var() ->funcを交換してください。今すぐ上書きできる変数です。

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

これはプロパティです。スウィフトオーバーライド:

override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 
    get { 
     return UIInterfaceOrientationMask.all 
    } 
} 
関連する問題