显示一个视图控制器后的选项卡栏控制器
我想问一下,在显示一个视图控制器后是否可以显示一个 tabbarcontroller。 我看过很多关于 tabbarcontroller 的教程,但它们都使用这一行放入 AppDelegate 中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[self.window addSubview:tabController.view];
[self.window makeKeyAndVisible];
return YES;}
我想做的是首先显示一个视图控制器:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES; }
显示 viewController 后,用户必须单击一个按钮才能显示TABBARCONTROLLER 的另一个视图。如果可能的话,我该怎么做?
I would like to ask if it's possible to show a tabbarcontroller after I showed one view controller.
I've seen lots of tutorials about tabbarcontroller but they were all put in the AppDelegate using this line:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[self.window addSubview:tabController.view];
[self.window makeKeyAndVisible];
return YES;}
What I would like to do is show one view controller first:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES; }
and after showing the viewController, the user will have to click a button to show another view with the TABBARCONTROLLER. If that's possible, how do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,您可以...在您的第一个控制器中,完成某些工作后,然后按 Tabbar 控制器。
示例:-
假设您通过子类化 UITabBarController 拥有 TabBarController 类。
编辑自定义标签栏:
.h文件
.m文件:
您还需要相应地实现标签栏的委托方法....
Yes you can... in your first controller, after some job is completed then push the Tabbar controller.
Example:-
Assuming you have TabBarController class by sub classing UITabBarController.
EDITED custom tab bar :
.h file
.m file :
Also you need to implement Tab bar's delegate methods accordingly....
我遇到了导航控制器和选项卡栏视图控制器的情况,但您需要视图控制器,所以我根据您的要求修改我的代码。检查n回复
首先在应用程序委托 .h 文件中初始化视图控制器和选项卡栏控制器
&给属性也像:
比在.m文件中将视图控制器设置为视图,因为您要首先设置简单的视图控制器,例如:
现在在这个视图控制器中,在您想要跳转到选项卡视图控制器用户的特定事件中:
I had a situation with navigation controller and tab bar view controller but ur need is with view controller so i modify my code according to ur requirement.check n reply
first initialize view controller and tabbar controller both in app delegate .h file
& give property also like:
than in .m file set the view controller to the view as u want to set simple view controller first, like :
Now in the this view controller on the particular event where u want to jump to tabbar view controller user this :
将 UITabBarController 保留为窗口的根视图控制器。将您的其他视图控制器呈现为模态视图控制器。关闭模态视图控制器以显示选项卡栏控制器。
Leave the UITabBarController as your window's root view controller. Present your other view controller as a modal view controller. Dismiss the modal view controller to reveal the tab bar controller.