我的应用仅在横向模式下运行,但我想在UIImagePicker中以纵向模式查看一个视图。
我在viewController中编写以下内容
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
} else {
return (interfaceOrientation = UIInterfaceOrientationPortraitUpsideDown);
}
}
// iOS6
(BOOL)shouldAutorotate {
return YES;
}
// iOS6
(NSUInteger)supportedInterfaceOrientations {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return (UIInterfaceOrientationMaskLandscape);
// return (UIUserInterfaceLayoutDirectionLeftToRight || UIUserInterfaceLayoutDirectionRightToLeft);
} else {
return UIInterfaceOrientationMaskPortrait;
}
}
// Added after comment
(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return UIInterfaceOrientationLandscapeLeft;
} else {
return UIInterfaceOrientationPortrait;
}
}
在DriverAddPage.m上我写了
(BOOL)shouldAutorotate {
return YES;
}
// iOS6
(NSUInteger)supportedInterfaceOrientations {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return (UIInterfaceOrientationMaskPortrait);
} else {
return UIInterfaceOrientationMaskPortrait;
}
}
我做错了什么?帮助我。
提前谢谢。