Ios 使用选项卡栏上的pushViewController加载页面
我有带tabbar botton的UIViewController,还有导航栏和导航项, 当我按下导航项中的按钮想要加载视图时,我不知道如何在tabbar上加载该视图 请你帮帮我,提前谢谢Ios 使用选项卡栏上的pushViewController加载页面,ios,objective-c,uinavigationcontroller,uitabbarcontroller,uitabbar,Ios,Objective C,Uinavigationcontroller,Uitabbarcontroller,Uitabbar,我有带tabbar botton的UIViewController,还有导航栏和导航项, 当我按下导航项中的按钮想要加载视图时,我不知道如何在tabbar上加载该视图 请你帮帮我,提前谢谢 -(IBAction) infoPage:(id)sender { InfoCtrol *i = [[InfoCtrol alloc] initWithNibName:@"InfoCtrol" bundle:nil]; [self.navigationC
-(IBAction) infoPage:(id)sender
{
InfoCtrol *i = [[InfoCtrol alloc] initWithNibName:@"InfoCtrol" bundle:nil];
[self.navigationController pushViewController:i animated:YES];
}
这将加载InfoCtrol控制器并将xib中的Touch UpInside事件设置为infoPage方法您的意思是在导航中按下新控制器时隐藏选项卡栏吗
如果是真的。UIViewController类中有一个属性HidesBottomBar。共享更多代码,self.navigationController可能为零,看起来您有UIViewController(_viewCtrl1,_viewCtrl2,_viewCtrl3)…但没有UINavigationController?@shahid rasheed它没有与NSNotification Center一起工作,当我使用此代码时,它正常工作,但我想使用NSNotificationCenteradd断点并检查infoPage:方法是否被通知调用?发布通知时,请确保UIViewControoler(观察者)应位于内存中。
// Instead of adding ViewController to TabbarController, add NavigationControllers.
// Eg.
UINavigationController *NavController = [[UINavigationController alloc] initWithRootViewController:_viewCtrl1];
[watchListNavController.navigationBar setTintColor:[UIColor blackColor]];
_tabC = [[UITabBarController alloc] init];
_tabCt.viewControllers = [NSArray arrayWithObjects:NavController,_viewCtrl2,_viewCtrl3, nil];
// Now you can use Push and Pop In your _viewCtrl1.
// Do same with all the viewController