2011-11-01 26 views
0

我必須允許所有視圖中的橫向方向,因爲其中一個需要處理橫向方向,而我的應用是基於tabbar的iphone應用。現在有些視圖在設備處於橫向模式時顯然很難看。我正在考慮繼承UIView並使用子類在用戶在某些視圖中不處於肖像模式時顯示「警告」屏幕。關於什麼可能是關於它的最佳實踐的任何想法?防止用戶在橫向上看到一些視圖

THX幫助,

斯特凡

回答

1

有一個willRotateToInterfaceOrientation:在UIViewController類toInterfaceOrientation方法。 iOS在最終用戶旋轉手機時調用它。您可以覆蓋它以顯示和隱藏警告消息。

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
    if (! UIDeviceOrientationIsPortrait (toInterfaceOrientation)) 
     [self displayWarningMessage]; 
    else 
     [self hideWarningMessage]; 
} 
+0

是的我知道但我問的是否不符合Apple準則 – Steve