当用户在我的通用应用程序的 iPad 端点击导航栏中的“设置”按钮时,我需要将 viewController 显示为 formSheet
。该 View 称为“SettingsViewController”,它是我的 iPad Storyboard 中的一个 View Controller ,ID 为“settings”。
我没有使用 segues,因为在我的 iPad 版本的应用程序中,我在左侧的导航栏中有多个按钮,所以我必须以编程方式添加按钮。 (无法将 segue 连接到 Storyboard中不存在的 UIBarButtonItem。)
我想要的功能在那里,演示文稿没有。
当我在 iPad 上显示我的 SettingsViewController
时,它显示为全屏 View 。
我需要它作为表格。
我将它包装在一个 NavigationController
中,我需要它并且工作正常,只需要它以正确的方式呈现自己。
这是呈现 View 的代码:
-(void)showSettings:(id)sender {
SettingsViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:@"settings"];
svc.delegate = self;
svc.modalPresentationStyle = UIModalPresentationFormSheet;
UINavigationController *navcont = [[UINavigationController alloc] initWithRootViewController:svc];
[self presentViewController:navcont animated:YES completion:NULL];
}
我已经尝试了所有我能想到的。非常感谢任何帮助。
最佳答案
看起来您在 Settings ViewController
上设置了模态呈现样式,但您应该在 UINavigationController
上设置它。
关于ios - iPad presentViewController 总是全屏(需要 formSheet)iOS6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13871968/