如何将选项卡栏添加到默认视图并使用导航控制器与其他视图进行通信
它可能很简单,但无法找到确切的解决方案。我正在使用 xcode 4.2。
我想在我的应用程序的视图之一中使用选项卡栏。我浏览了许多教程,所有教程都与基于导航的应用程序和其他基于视图的应用程序相关。即使我了解如何在主视图的故事板中添加选项卡栏控制器。
我需要的是我有一个名为 Homepage.h 和 .m 和 .xib 的类,它是 UIViewController 类的子类。同样,我的类不是主类,它是稍后为其中一个视图添加的。所以我想添加一个选项卡栏并进行通信带有导航栏和其他视图,所以我该怎么做,请给我一些示例。
问题是我想将选项卡栏添加到默认 UIView 并与导航控制器和其他视图进行通信。我不想从实用程序中拖动选项卡栏控制器。如果我拖动,我如何才能使其在从一个视图移动到另一个视图时查看,因为我已经有一个默认 UIview。请给我链接或任何教程,我可以在其中添加选项卡栏和使用导航控制器在视图之间切换。
注意:我正在使用基于单一视图的应用程序
It might be simple but not able to find exact solution for this.i am using xcode 4.2.
I want to use Tab bar in one of the view in my application. i went through many tutorials all tutorials are related to navigation based application and other view based application.Even i understood how to add a tab bar controller in story board which is main view.
What i need is i have class called Homepage.h and .m and .xib which is subclass of UIViewController class.Again my class is not main class its added later for one of the view.So i want to add a tab bar and communicate with navigationBar and other views so how can i do it plz give me some samples.
Problem is i want to add Tab bar to the default UIView and communicate with navigation controller and other views. i dont want to drag Tab bar controller from utilities.Incase if i drag how can i make it view on moving from one view to another as i already have a Default UIview.Please give me links or any tutorials where i can add tab bar and switch between views using navigation controller.
NOTE: i am using Single View based Application
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取AppDelegate.h中的UINavigationController对象和UITabBarController对象
AppDelegate.h中
@property (nonatomic, keep) UITabBarController *tabbar;
@property(非原子,保留)UINavigationController *navController;
IN AppDelegate.m
@synthesize tabbar,navController;
在ApplicationdidFinishLaunching
tabbar=[[UITabBarController alloc]init];
navController=[[UINavigationController alloc]initWithRootViewController:first];
NSArray *viewControllerArray=[[[NSArray alloc] initWithObjects:navController1,第二个,第三个,nil] autorelease];
编写此代码不需要将 Tabbar 放入 XIB 中。试试这个代码,它会对你有帮助。
Take UINavigationController object and UITabBarController object in AppDelegate.h
In AppDelegate.h
@property (nonatomic, retain) UITabBarController *tabbar;
@property (nonatomic, retain) UINavigationController *navController;
IN AppDelegate.m
@synthesize tabbar,navController;
in ApplicationdidFinishLaunching
tabbar=[[UITabBarController alloc]init];
navController=[[UINavigationController alloc]initWithRootViewController:first];
NSArray *viewControllerArray=[[[NSArray alloc] initWithObjects:navController1,second,third,nil] autorelease];
Write this code and dont need to put Tabbar in XIB. Try thi code it will helps you.