在AppDelegate.h中@property (strong, nonatomic) UINavigationController *navigationController;在AppDelegate.m中self.navigationController=[[UINavigationController alloc]initWithRootViewController:self.viewController];
[self.window addSubview:navigationController.view];在用navigationcontroller跳轉(zhuǎn)到一個tabbar的界面,主視圖為TabbarMain在TabbarMain.h中@interface TabbarMain : UITabBarController<UITabBarControllerDelegate>@property (strong, nonatomic) UITabBarController *controller;在TabbarMain.m中UIViewController *huntingMain=[[HuntingMain alloc]initWithNibName:@"HuntingMain" bundle:nil]; UIViewController *restaurantMain=[[RestaurantMain alloc]initWithNibName:@"RestaurantMain" bundle:nil];
restaurantMain.navigationController.view=self.navigationController; UIViewController *settingMain=[[SettingMain alloc]initWithNibName:@"SettingMain" bundle:nil]; UIViewController *moreMain=[[MoreMain alloc]initWithNibName:@"MoreMain" bundle:nil];
controller=[[UITabBarController alloc]init];
controller.viewControllers=[NSArray arrayWithObjects:huntingMain, restaurantMain, settingMain,moreMain,nil];//添加4個tabitem
controller.delegate=self;
[self.view addSubview:controller.view];在TabbarMain.m是可以使用[self.navigationController pushViewController:view animated:YES];來進行頁面的跳轉(zhuǎn)但是在某一個tabitem頁面中再使用上面的方法就跳轉(zhuǎn)不了,估計是導(dǎo)航控制器對這些tabitem沒用(比如說在某個選項卡中有一個列表,單擊某項進行跳轉(zhuǎn)),不知道要怎么樣才能在tabitem的頁面中使用類似[self.navigationController pushViewController:view animated:YES];來進行跳轉(zhuǎn)
1 回答

白板的微信
TA貢獻1883條經(jīng)驗 獲得超3個贊
用UINavigationController來組織你的Tabbar下的viewcontroller
TabbarMain.m
UIViewController *huntingMain=[[HuntingMain alloc]initWithNibName:@"HuntingMain" bundle:nil]; navigationController=[[UINavigationController alloc]initWithRootViewController:self.huntingMain]; controller=[[UITabBarController alloc]init]; controller.viewControllers=[NSArray arrayWithObjects:navigationController, restaurantMain, settingMain,moreMain,nil];/
- 1 回答
- 0 關(guān)注
- 182 瀏覽
添加回答
舉報
0/150
提交
取消