我正在为IOS制作视频播放器&想要检查设备何时旋转,何时它是我的代码将使视频播放器全屏,但是我是收到以下错误 - “实例成员“currentDevice的viewController‘'currentDevice'的实例成员不能用于类型
var currentDevice: UIDevice = UIDevice.currentDevice()
var orientation: UIDeviceOrientation = currentDevice.orientation //error here
if orientation.isLandscape {
}
if orientation.isPortrait {
}
我已经试过的东西多,以取代currentDevice,我也试图把_
下,它不能在使用类型’和也是self.
几天前我开始和Swift一起工作,请问有谁能指出我正确的方向?
你在哪里把你的viewcontroller类的发布代码? – Surely
将代码放在viewDidLoad()或函数中。 –
上面的变量我的viewDiDLoad();功能 – Gerwin