Tag: shouldautorotate

shouldAutorotate呼吁iPhone,但不是在iPad上

我有iOS 8/9的通用应用程序,其中包含MainStoryboard_iPhone和MainStoryboard_iPad。 故事板中的入口点是带有选项卡栏的RootViewController。 RootViewController控制器非常简单 – (void)viewDidLoad { [(VIBAppDelegate *)[[UIApplication sharedApplication] delegate] setRootViewController:self]; self.interfaceOrientationMask = UIInterfaceOrientationMaskAll; self.preferredOrientation = UIInterfaceOrientationMaskAll; [super viewDidLoad];} – (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } – (UIInterfaceOrientationMask)supportedInterfaceOrientations{ return self.interfaceOrientationMask; } – (BOOL)shouldAutorotate{ return YES; } – (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ UIViewController *currentVC = self.selectedViewController; if ([currentVC respondsToSelector:@selector(preferredInterfaceOrientationForPresentation)]) { UIInterfaceOrientation orientation = [currentVC preferredInterfaceOrientationForPresentation]; return orientation; }else{ return […]

用Photolibrary设置应该为假

如果我添加一个popup窗口,可以从iPad访问我的照片库,系统总是会出现以下消息: 由于未捕获exception“UIApplicationInvalidInterfaceOrientation”而终止应用程序,原因:“支持的方向与应用程序没有共同的方向,[PUUIAlbumListViewController shouldAutorotate]返回YES' 但是我已经在我的Projekt信息中设置了支持横向模式。 所以我添加了以下function override func shouldAutorotate() -> Bool { return false } 但我不知道如何使用它? 如果我在我的应用程序上启用UIInterfaceOrientationPortrait ,它也能正常工作。 但是我不想支持UIInterfaceOrientationPortrait 。 我会打电话给我的popover像这样: var popover: UIPopoverController = UIPopoverController(contentViewController: ImagePickerController) popover.presentPopoverFromBarButtonItem(addImageButton, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true) 任何帮助将不胜感激