OGeek|极客世界-中国程序员成长平台

标题: ios - presentModalViewController 不显示工具栏? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 16:22
标题: ios - presentModalViewController 不显示工具栏?

我有一个试图显示为 UIModalPresentationFormSheet 的 View Controller ,但是它没有显示它的 UIToolbar。如何在其上显示工具栏?

ConnectionEditViewController * connectionEditViewController = [[ConnectionEditViewController alloc] initWithNibName"ConnectionEditViewController" bundle: nil];
connectionEditViewController.modalInPopover = YES;
connectionEditViewController.modalPresentationStyle = UIModalPresentationFormSheet;
connectionEditViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController: connectionEditViewController animated: YES];



Best Answer-推荐答案


创建一个 UINavigationController 实例,将 rootViewController 设置为您的 connectionEditViewController,然后为 UINavigationController 配置模态属性并呈现。

如果这是在 iPad 上,它应该会弹出带有导航栏的 View 作为顶部的灰色工具栏。 配置connectionEditViewController的navigationItem来配置导航栏。

关于ios - presentModalViewController 不显示工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4291656/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4