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

标签 ios xcode ipad storyboard presentmodalviewcontroller

当用户在我的通用应用程序的 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/

相关文章:

ios - 幸存的ios内存警告

iphone - 检查 NSDecimalNumber 是否为整数

带有背景的 iOS UIPageViewController

swift - Xcode 10 : Our project causes Interface builder to crash or fail to render constantly. 在项目外部打开 Storyboard时工作正常

iphone - iPhone monotuch 中带有可选项目的警报 View

ios - 隐藏另一个 View 时调整 View 大小

php - iPhone、PHP、MySQL 通信

ios - Xcode NSManagedObject 子类在标记为非可选时包含可选

iphone - 用相同的方法更新 UILabel 两次

使用 Xcode 8 的 IOS 5 兼容性