iPad presentViewController总是全屏(需要formSheet)iOS6

jhi*_*t00 7 xcode storyboard ipad presentmodalviewcontroller ios

formSheet当用户点击我的通用应用程序的iPad侧导航栏中的"设置"按钮时,我需要提供一个viewController .该视图称为"SettingsViewController",它是我的iPad故事板中的视图控制器,ID为"设置".

我没有使用segue,因为在我的iPad版本的应用程序中,我在左侧的导航栏中有多个按钮,所以我必须按程序添加按钮.(无法将segue连接到故事板中不存在的UIBarButtonItem.)

我想要的功能在那里,演示文稿不是.当我SettingsViewController在iPad上呈现我的时候,它呈现为全屏视图.我需要它作为表单.

我把它包装成一个NavigationController,我需要并且工作正常,只需要它以正确的方式呈现自己.

这是显示视图的代码:

-(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];

}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了所有我能想到的东西.非常感谢任何帮助.

ger*_*iam 23

看起来你设置了模态演示样式,SettingsViewController但你应该在你的上面设置它UINavigationController.


Gan*_*ank 6

navcont.modalPresentationStyle = UIModalPresentationFormSheet;
Run Code Online (Sandbox Code Playgroud)