首先您在應用程序委託文件中聲明布爾類型變量,然後在.m文件中設置屬性併合成。在APP-delegate.m文件ù
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
MidwestTestAppDelegate *appDelegate = (MidwestTestAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.isLandscapeLeft = TRUE;
}
else
{
MidwestTestAppDelegate *appDelegate = (MidwestTestAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.isLandscapeLeft = FALSE;
}
} 在.m文件u使用此功能,給ü定向啓用與否。同樣你做視圖控制器。
來源
2011-08-03 06:17:16
ram
谷歌serach導航控制器的方向變化 – ram
你應該看看presentModalViewController而不是pushViewController,因爲push假設方向相同,而現在沒有。 – msgambel