Ios UINavigationView无法弹出,仅导航弹出动画,UIViewController未更改
我使用自定义Ios UINavigationView无法弹出,仅导航弹出动画,UIViewController未更改,ios,objective-c,uinavigationcontroller,uitabbarcontroller,Ios,Objective C,Uinavigationcontroller,Uitabbarcontroller,我使用自定义UINavigationController作为rootViewController。UINavigationController的第一个视图控制器是一个UITabBarController。每个UITabBarController都是一个自定义UINavigationConller。当显示tabBarController时,我隐藏rootViewController的导航栏 +(void)tabController:(UIViewController *)tabController
UINavigationController
作为rootViewController。UINavigationController的第一个视图控制器是一个UITabBarController
。每个UITabBarController
都是一个自定义UINavigationConller
。当显示tabBarController
时,我隐藏rootViewController的
导航栏
+(void)tabController:(UIViewController *)tabController pushSubController:(UIViewController *)subViewController
{
[tabController.rdv_tabBarController.navigationController pushViewController:subViewController animated:YES];
tabController.rdv_tabBarController.navigationController.navigationBarHidden = FALSE;
}
初始化UITabbarController
将其设置为navigationController
在baseViewController中,我在导航栏中自定义back项
在某些情况下,在推送动画完成后推送viewController
时,我会更改navigationController
的viewControllers
。我使用navigationController+块
完成后,执行块
[UIHelper viewController:self pushViewController:orderDetail completion:^{
NSMutableArray *afterController = [NSMutableArray array]; //将本页面删除
NSArray *viewController = self.navigationController.viewControllers;
[viewController enumerateObjectsUsingBlock:^(UIViewController *obj, NSUInteger idx, BOOL *stop) {
if (![obj isKindOfClass:[ESPurchaseViewController class]]) {
[afterController addObject:obj];
}
}];
self.navigationController.viewControllers = afterController;
}];
在一些推送中,当我从UITabBarController
推送到secondViewController
时,我隐藏navigationBar
并显示根navigationBar
+(void)tabController:(UIViewController *)tabController pushSubController:(UIViewController *)subViewController
{
[tabController.rdv_tabBarController.navigationController pushViewController:subViewController animated:YES];
tabController.rdv_tabBarController.navigationController.navigationBarHidden = FALSE;
}
我找不到导航不能弹出的原因。这种情况并不总是发生。
关于UINavigationContller
,uitabarcontroller
,UIViewController
的iOS基本知识有任何错误吗?
谢谢大家! 如果我认为您需要的是第一个MainNavigationViewController,然后是带有它的tabbar控制器,并且每个tab栏的视图控制器也有自己的nvaigation控制器,那么它可以正常工作
listViewController = [[CBListViewController alloc] initWithStyle:UITableViewStylePlain];
bookmarkController = [[CBBookmarksViewController alloc] initWithStyle:UITableViewStylePlain];
settingsController = [[CBActivityViewController alloc] init ];
searchController = [[CBSearchViewController alloc] initWithNibName:@"CBSearchViewController" bundle:nil];
nearbyController = [[CBViewOnMapViewController alloc] init ];
UINavigationController *bNavigationController = [[UINavigationController alloc] initWithRootViewController:bookmarkController];
self.navigationControllerForBookmark = bNavigationController;
UITabBarItem *tab2=[[UITabBarItem alloc]init];
tab2.image = [[UIImage imageNamed:@"bookmark.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab2.selectedImage = [[UIImage imageNamed:@"bookmark_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab2.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForBookmark.tabBarItem = tab2;
UINavigationController *cNavigationController = [[UINavigationController alloc] initWithRootViewController:settingsController];
self.navigationControllerForSettings = cNavigationController;
UITabBarItem *tab3=[[UITabBarItem alloc]init];
tab3.image = [[UIImage imageNamed:@"activites.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab3.selectedImage = [[UIImage imageNamed:@"activites_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab3.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForSettings.tabBarItem = tab3;
UINavigationController *dNavigationController = [[UINavigationController alloc] initWithRootViewController:searchController];
self.navigationControllerForSearch = dNavigationController;
UITabBarItem *tab4=[[UITabBarItem alloc]init];
tab4.image = [[UIImage imageNamed:@"Search.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab4.selectedImage = [[UIImage imageNamed:@"Search_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationController.tabBarItem = tab4;
tab4.imageInsets=UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForSearch.tabBarItem=tab4;
UINavigationController *eNavigationController = [[UINavigationController alloc] initWithRootViewController:nearbyController];
self.navigationControllerForNearby = eNavigationController;
UITabBarItem *tab5=[[UITabBarItem alloc]init];
tab5.image = [[UIImage imageNamed:@"nearby.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab5.selectedImage = [[UIImage imageNamed:@"nearby_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationController.tabBarItem = tab5;
tab5.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForNearby.tabBarItem = tab5;
[navigationControllerForNearby.navigationBar setBackgroundImage:[UIImage imageNamed:@"headerBar"] forBarMetrics:UIBarMetricsDefault];
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:listViewController];
self.navigationController = aNavigationController;
UITabBarItem *tab1=[[UITabBarItem alloc]init];
tab1.image = [[UIImage imageNamed:@"review.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab1.selectedImage = [[UIImage imageNamed:@"review_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab1.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationController.tabBarItem = tab1;
[[UITabBar appearance] setBarTintColor:GRAY_COLOR];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navigationController, navigationControllerForNearby, navigationControllerForSearch, navigationControllerForBookmark, navigationControllerForSettings, nil];
self.window.rootViewController = self.tabBarController;
检查这是否解决了您的问题,先生。谢谢您的回答。我使用RDVTAbbarController替换系统的UIAbbarController。tabbarcontroller有一个navigationcontroller,每个tab栏的视图控制器也有自己的nvaigation控制器。您是否收到Sir抱歉稍后重播。我的方法和你告诉我的一样。看来这并不能解决问题。
[UIHelper viewController:self pushViewController:orderDetail completion:^{
NSMutableArray *afterController = [NSMutableArray array]; //将本页面删除
NSArray *viewController = self.navigationController.viewControllers;
[viewController enumerateObjectsUsingBlock:^(UIViewController *obj, NSUInteger idx, BOOL *stop) {
if (![obj isKindOfClass:[ESPurchaseViewController class]]) {
[afterController addObject:obj];
}
}];
self.navigationController.viewControllers = afterController;
}];
+(void)tabController:(UIViewController *)tabController pushSubController:(UIViewController *)subViewController
{
[tabController.rdv_tabBarController.navigationController pushViewController:subViewController animated:YES];
tabController.rdv_tabBarController.navigationController.navigationBarHidden = FALSE;
}
listViewController = [[CBListViewController alloc] initWithStyle:UITableViewStylePlain];
bookmarkController = [[CBBookmarksViewController alloc] initWithStyle:UITableViewStylePlain];
settingsController = [[CBActivityViewController alloc] init ];
searchController = [[CBSearchViewController alloc] initWithNibName:@"CBSearchViewController" bundle:nil];
nearbyController = [[CBViewOnMapViewController alloc] init ];
UINavigationController *bNavigationController = [[UINavigationController alloc] initWithRootViewController:bookmarkController];
self.navigationControllerForBookmark = bNavigationController;
UITabBarItem *tab2=[[UITabBarItem alloc]init];
tab2.image = [[UIImage imageNamed:@"bookmark.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab2.selectedImage = [[UIImage imageNamed:@"bookmark_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab2.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForBookmark.tabBarItem = tab2;
UINavigationController *cNavigationController = [[UINavigationController alloc] initWithRootViewController:settingsController];
self.navigationControllerForSettings = cNavigationController;
UITabBarItem *tab3=[[UITabBarItem alloc]init];
tab3.image = [[UIImage imageNamed:@"activites.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab3.selectedImage = [[UIImage imageNamed:@"activites_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab3.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForSettings.tabBarItem = tab3;
UINavigationController *dNavigationController = [[UINavigationController alloc] initWithRootViewController:searchController];
self.navigationControllerForSearch = dNavigationController;
UITabBarItem *tab4=[[UITabBarItem alloc]init];
tab4.image = [[UIImage imageNamed:@"Search.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab4.selectedImage = [[UIImage imageNamed:@"Search_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationController.tabBarItem = tab4;
tab4.imageInsets=UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForSearch.tabBarItem=tab4;
UINavigationController *eNavigationController = [[UINavigationController alloc] initWithRootViewController:nearbyController];
self.navigationControllerForNearby = eNavigationController;
UITabBarItem *tab5=[[UITabBarItem alloc]init];
tab5.image = [[UIImage imageNamed:@"nearby.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab5.selectedImage = [[UIImage imageNamed:@"nearby_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationController.tabBarItem = tab5;
tab5.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForNearby.tabBarItem = tab5;
[navigationControllerForNearby.navigationBar setBackgroundImage:[UIImage imageNamed:@"headerBar"] forBarMetrics:UIBarMetricsDefault];
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:listViewController];
self.navigationController = aNavigationController;
UITabBarItem *tab1=[[UITabBarItem alloc]init];
tab1.image = [[UIImage imageNamed:@"review.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab1.selectedImage = [[UIImage imageNamed:@"review_active.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab1.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationController.tabBarItem = tab1;
[[UITabBar appearance] setBarTintColor:GRAY_COLOR];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navigationController, navigationControllerForNearby, navigationControllerForSearch, navigationControllerForBookmark, navigationControllerForSettings, nil];
self.window.rootViewController = self.tabBarController;