2
我在我的應用程序中有兩個視圖; 「計算器」和「磁帶」。我可以點擊計算器裏面的按鈕來找到磁帶,反之亦然。我按照下面的代碼設置了輪轉,大部分時間都能正常工作。自動旋轉ios6不按預期工作
但是,如果我將計算器視圖或磁帶視圖旋轉到橫向,然後如果我嘗試訪問其他視圖,界面就會全部混亂,就像它無法識別該設備已被旋轉一樣。有什麼建議麼?
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation duration:(NSTimeInterval)duration
{
[self doLayoutForOrientation:toInterfaceOrientation];
}
- (void)doLayoutForOrientation:(UIInterfaceOrientation)orientation {
if (UIInterfaceOrientationIsPortrait(orientation))
{
//set the frames here
}
else
{
//set the frames here
}
}
當您從已經旋轉的視圖轉到另一個視圖(比如磁帶)時,設備無法識別該視圖已被更改。 –
所以你需要檢查設備的當前方向,在視圖中會出現下一個視圖並調整視圖 –
好極了,像夢一樣工作。 –