我有一個使用UISplitViewController的佈局,每個窗格底部都有一些自定義控件。當我將視圖旋轉到肖像模式時,我想在彈出模式下隱藏主視圖控件。這部分工作正常。顯示/隱藏旋轉前的控件
下面的代碼:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
if(UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
_refreshButton.hidden = NO;
_aboutButton.hidden = NO;
_bottomBar.hidden = NO;
}
if(UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
_refreshButton.hidden = YES;
_aboutButton.hidden = YES;
_bottomBar.hidden = YES;
}
}
}
問題是,當我回旋轉爲橫向模式。控件重新出現,但只有在旋轉完成後。它很實用,但很醜。有沒有辦法強制他們在輪換實際發生之前重新繪製?
只是在黑暗中刺,直到你做,但是你有沒有嘗試將該調用移動到隱藏/顯示代碼下方的超級實現? – Till
@Till:好主意,但沒有骰子。 – peteyfrogboy