![](/img/trans.png)
[英]Can I observe when a UIViewController changes interfaceOrientation?
[英]UIViewController interfaceOrientation Property Deprecated
我目前正在使用我的UIViewController的interfaceProperty ,從iOS 8開始已棄用。
@property(nonatomic,readonly) UIInterfaceOrientation interfaceOrientation NS_DEPRECATED_IOS(2_0,8_0);
我正在使用上述屬性來確定物理“主頁”按鈕的方向,以便進行加速度計和重力矢量校正。 UIDeviceOrientation不是合適的替代方法,因為這些更正實際上已應用於用戶界面 。
我已經搜索了合適的重構建議,但是,它們不適用於我對財產的使用。
您可以嘗試使用
UIApplication.sharedApplication()。statusBarOrientation
它將返回一個UIInterfaceOrientation值,您可以使用該值獲取設備的接口方向。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.