亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在某一個tabitem頁面中再使用上面的方法就跳轉不了,估計是導航控制器對這些tabitem沒用?

在某一個tabitem頁面中再使用上面的方法就跳轉不了,估計是導航控制器對這些tabitem沒用?

iOS
繁星淼淼 2023-04-15 21:17:36
在AppDelegate.h中@property (strong, nonatomic) UINavigationController *navigationController;在AppDelegate.m中self.navigationController=[[UINavigationController alloc]initWithRootViewController:self.viewController];     [self.window addSubview:navigationController.view];在用navigationcontroller跳轉到一個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];來進行頁面的跳轉但是在某一個tabitem頁面中再使用上面的方法就跳轉不了,估計是導航控制器對這些tabitem沒用(比如說在某個選項卡中有一個列表,單擊某項進行跳轉),不知道要怎么樣才能在tabitem的頁面中使用類似[self.navigationController pushViewController:view animated:YES];來進行跳轉
查看完整描述

1 回答

?
白板的微信

TA貢獻1883條經驗 獲得超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];/


查看完整回答
反對 回復 2023-04-18
  • 1 回答
  • 0 關注
  • 185 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號