自己刚开始学习iPhone ,在前辈们的指导下做了点东西,现在写下来,以备以后回顾之用....
现在要在TabBarController的两个item分别实现一个navgationcontroller
1.建立一个tabbar输出口和两个nav输出口
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController2;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
2.双击MWainindow.xib打开IB,从Library里面拖一个Tab Bar Controller到MWainindow.xib
3.按住Ctrl,把App Delegate拖到 Window上选择window.
4. 按住Ctrl,把 File's Owner拖到App Delegate,选择delegate,
5. 按住Ctrl,把 App Delegate 连接到TabBarController,并选择TabBarController的输出口,也就是前面写的 tabBarController (注意,点击这个 TabBarController 的时候,他的viewcontroller的NIB不要设置 ) .
6.从Library拖两个 NavigationController到 MWainindow.xib的 Tab Bar Controller下,也就是属于 Tab Bar Controller.
7. 按住Ctrl,把 App Delegate 连接到这两个 NavigationController ,并选择 NavigationController 的输出口,也就是前面写的 navigationController和 navigationController2 .(注意,点击这个 navigationController的时候,他的viewcontroller的NIB不要设置 )
8.选择 navigationController下的viewcontroller,这时候你可以编辑NIB了,首先cmd+1,可以设置title,NIB,然后cmd+4,选择这个viewcontroller的class,同理设置好另一个 navigationController,这样就可以用IB实现在TabBarController的item上加两个navgationcontroller