0
我正在一個應用程序中,我有閃屏和主屏幕。我的應用程序是橫向和縱向模式應用程序當我的應用程序啓動並且處於橫向模式時,我的主屏幕會顯示縱向模式一段時間,然後進入橫向模式。我希望它應該直接以橫向模式顯示視圖。Iphone風景和人像問題
感謝
我正在一個應用程序中,我有閃屏和主屏幕。我的應用程序是橫向和縱向模式應用程序當我的應用程序啓動並且處於橫向模式時,我的主屏幕會顯示縱向模式一段時間,然後進入橫向模式。我希望它應該直接以橫向模式顯示視圖。Iphone風景和人像問題
感謝
我通常啓用通知:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
在我的控制器,我把:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[self configureOrientation:toInterfaceOrientation];
}
- (void)configureOrientation:(UIInterfaceOrientation)orientation
{
if(UIDeviceOrientationIsValidInterfaceOrientation(orientation)){
if(UIInterfaceOrientationIsLandscape(orientation)){
[self configureLandscapelView];
}else if(UIInterfaceOrientationIsPortrait(orientation)){
[self configurePortraitlView];
}
}
}
您也可以從UIViewController中本身的定位:
UIInterfaceOrientation orientation = [self interfaceOrientation];
或從狀態欄:
[UIApplication sharedApplication] statusBarOrientation]
你能發表一些代碼嗎? – CarlJ 2012-02-21 16:09:53
有類似的問題,解決這個問題:http://stackoverflow.com/a/10146270/894671 – 2012-04-18 20:40:51