笔尖视图未显示菜单或导航栏

本杰明·波特(Benjamin Porter)

在我正在使用的应用程序中,我有一个配置文件选项卡,用户可以在其中查看与其帐户相关的所有信息,其中一个字段是他们参加的大学,而该字段旁边的是一个按钮,可以从表格中进行选择他们去的大学的价值观的看法。这是个人资料视图的屏幕截图:

在此处输入图片说明

当我点击选择按钮时,它将带我到具有大学列表的表格的另一个视图,一旦我选择了一个,它将带我回到配置文件视图,除非当我回到配置文件视图时,导航栏和buttom菜单丢失:

在此处输入图片说明

这是我在视图控制器之间使用的代码:

ProfileView * vc = [[ProfileView alloc] init];

    [self presentViewController:vc animated:YES completion:^{
    }];

有谁知道为什么会这样?

碧玉蓝调

Is ProfileView a subclass of UIView or UIViewController? In the latter case it should be renamed to ProfileViewController as the current name suggests that its a custom view. Otherwise, as comments suggest, you need to create a UIViewController for that view, if you going to use the following methods:

Presenting the detail view controller:

You're using [self presentViewController] which will simply present a view controller by sliding it from the bottom of the screen. On completion it can be dismissed with [vc dismissViewControllerAnimated:completion]. If you want a navigation bar to be included you can either:

  • Add a UINavigationBar to the presented view controller's view.
  • Put the presented view controller inside a navigation controller.

For the latter case:

[self presentViewController:[[UINavigationController alloc] 
    initWithRootViewController:vc]];

Alternatively, you can push the next view controller onto the current navigation controller's stack using:

[self.navigationController pushViewController:vc animated:YES];

这将使视图控制器从右侧滑过。

最后,对于某些替代方法,如果希望的话,可以使用以下方法显示ViewController和/或视图:

  • [UIView transitionWithView . . . ]
  • CAKeyFrameAnimation

但是,根据您在问题中描述的要求,不需要这些。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

导航栏未显示

来自分类Dev

UIButton图像未显示在导航栏中

来自分类Dev

Xcode导航栏,选项卡栏,表格视图标题未显示

来自分类Dev

导航栏未显示

来自分类Dev

导航栏未显示iOS Swift

来自分类Dev

我的导航视图未显示我的菜单项

来自分类Dev

导航菜单未显示

来自分类Dev

SwiftUI TabView + NavigationView导航栏未显示

来自分类Dev

导航栏未显示在移动设备上

来自分类Dev

导航栏下拉列表未以角度显示

来自分类Dev

菜单栏未显示

来自分类Dev

基础导航栏菜单按钮未填充

来自分类Dev

导航栏未显示

来自分类Dev

导航栏未显示在iOS Web视图上

来自分类Dev

导航栏未显示为块

来自分类Dev

Bootstrap可折叠的导航栏未显示

来自分类Dev

在导航栏顶部显示视图

来自分类Dev

图像未显示在悬停的导航栏中

来自分类Dev

从Segue显示视图时,导航栏消失

来自分类Dev

导航视图未显示

来自分类Dev

幻灯片导航栏菜单未全角显示

来自分类Dev

导航栏菜单折叠未打开

来自分类Dev

导航栏未内联显示

来自分类Dev

Bootstrap 导航栏未展开或显示菜单项

来自分类Dev

片段未显示在选定的导航栏上?

来自分类Dev

Bootstrap 3 导航栏在字体真棒移动视图后未显示所有细节

来自分类Dev

导航栏未显示在 childViewController 中

来自分类Dev

导航栏引导菜单未显示在移动设备中

来自分类Dev

导航栏不显示子菜单