弹出到 UINavigationController 的根目录后如何在 UIView 的底部显示 UIToolBar?
我无法显示位于视图底部的 UIToolbar,其中视图推动导航控制器,然后使用后退按钮弹出回视图。
在我创建的NIB中:
UIViewController RootViewController containing a
UIView containing a
UIToolbar at bottom of UIView
在RootViewController中,我创建下一个UIViewController,NextViewController,在其中创建一个NavigationController:
UIViewController RootViewController containing a
UIViewController NextViewController containing a
NavigationController
在NextViewController中,我可以从RootViewController看到UIToolbar。当我使用导航控制器中的后退按钮弹回 NextViewController 时,我无法再从 RootViewController 中看到 UIToolbar。有谁知道如何使 UIToolbar 可见?
我认为可行的一种方法是获取指向 UIToolbar 的指针并将其作为子视图添加到导航控制器中,如下所示:
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
RootViewController *rootViewController = appDelegate.rootViewController;
UIView *rootViewUIView = rootViewController.view;
UIToolbar *rootViewUIToolbar = rootViewUIView.toolbar;
[self.navigationController.view addSubview:rootViewUIToolbar];
但我收到错误:“请求成员 rootViewUIToolbar 位于非结构或联合中”,该行:
UIToolbar *rootViewUIToolbar = rootViewUIView.toolbar;
关于如何使用后退按钮从导航控制器弹回根视图后显示工具栏有什么想法吗?
I can't show a UIToolbar that was at the bottom of a view, where the view pushed a navigation controller and then popped back to the view using the back button.
In a NIB I've created:
UIViewController RootViewController containing a
UIView containing a
UIToolbar at bottom of UIView
In RootViewController I create next UIViewController, NextViewController, within which I create a NavigationController:
UIViewController RootViewController containing a
UIViewController NextViewController containing a
NavigationController
In NextViewController I can see the UIToolbar from RootViewController. When I pop back to NextViewController, using the back button, from the NavigationController I can no longer see the UIToolbar from RootViewController. Does anyone know how to make the UIToolbar visible?
One approach I thought would work was to get a pointer to the UIToolbar and add it as a subview to the navigation controller as:
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
RootViewController *rootViewController = appDelegate.rootViewController;
UIView *rootViewUIView = rootViewController.view;
UIToolbar *rootViewUIToolbar = rootViewUIView.toolbar;
[self.navigationController.view addSubview:rootViewUIToolbar];
But I get the error: "Request for member rootViewUIToolbar in something not a structure or a union" for the line:
UIToolbar *rootViewUIToolbar = rootViewUIView.toolbar;
Any ideas on how to show the toolbar after popping back to the root view from the navigation controller using the back button?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论