我希望我的應用程序在iPhone的方向更改時觸發操作,而不管用戶在應用程序中的位置。在應用程序中運行代碼而不管視圖
我使用
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight)) {
}
要檢查設備的方向。
我在哪裏放置這段代碼,以便它在方向改變時始終運行?
?或者在哪裏 – huddie96
當然,在應用程序代表將是一個很好的地方。 –