ios - UINavigationView 不能弹出,只有导航弹出动画,UIViewController 没变
<p><p>我使用自定义的 <code>UINavigationController</code> 作为 rootViewController。 <code>UINavigationController 的</code> 第一个viewController 是一个<code>UITabBarController</code>。每个 <code>UITabBarController</code> 都是一个自定义的 <code>UINavigationConller</code>。当显示 <code>tabBarController</code> 时,我隐藏了 <code>rootViewController 的</code> <code>navigationBar</code>。</p>
<blockquote>
<p>Init the <code>UITabbarController</code></p>
</blockquote>
<pre><code>+(RDVTabBarController *)tabBarControllertWithIndex:(NSUInteger)index
{
UIViewController *goodsHomeController = [ initWithNibName:nil bundle:nil];
UINavigationController *goodsHomeNavi = [
initWithRootViewController:goodsHomeController];
........
ESTabBarController *tabBarController = [ init]; //对status bar 能定制
];
return tabBarController;
}
</code></pre>
<blockquote>
<p>Set it to a <code>navigationController</code></p>
</blockquote>
<pre><code>self.tabController = ;
self.tableController.delegate = self;
UINavigationController *tabBarNavigation = ;
tabBarNavigation.navigationBarHidden = TRUE;
[ setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.rootViewController = tabBarNavigation;
</code></pre>
<blockquote>
<p>In the baseViewController ,I customise the back item in the navigationBar</p>
</blockquote>
<pre><code>- (void)setCustomNavigationBackButton
{
UIImage *backBtn = ;
UIImage *backDownBtn = ;
backBtn = ;
backDownBtn = ;
self.navigationItem.backBarButtonItem.title=@"";
self.navigationController.navigationBar.backIndicatorImage = backBtn;
self.navigationController.navigationBar.backIndicatorTransitionMaskImage = backBtn;
}
</code></pre>
<blockquote>
<p>In some cases, I change the <code>viewControllers</code> of a <code>navigationController</code> when I push a <code>viewController</code> after the push animation is finished. I use a navigationController+block</p>
</blockquote>
<pre><code>- (void)popToViewController:(UIViewController *)viewController animated:(BOOL)animated onCompletion:(void(^)(void))completion
{
;
;
;
;
}
</code></pre>
<p>完成后执行 block </p>
<pre><code> [UIHelper viewController:self pushViewController:orderDetail completion:^{
NSMutableArray *afterController = ; //将本页面删除
NSArray *viewController = self.navigationController.viewControllers;
[viewController enumerateObjectsUsingBlock:^(UIViewController *obj, NSUInteger idx, BOOL *stop) {
if (!]) {
;
}
}];
self.navigationController.viewControllers = afterController;
}];
</code></pre>
<p>在某些推送中,当我从 <code>UITabBarController</code> 推送到 <code>secondViewController</code> 时,我隐藏 <code>navigationBar</code> 并显示根 <code>navigationBar </code>.</p>
<pre><code>+(void)tabController:(UIViewController *)tabController pushSubController:(UIViewController *)subViewController
{
;
tabController.rdv_tabBarController.navigationController.navigationBarHidden = FALSE;
}
</code></pre>
<p>找不到导航弹不出来的原因。这并不总是发生。
关于 <code>UINavigationContller</code>,<code>UITabBarController</code>,<code>UIViewController</code> 的 iOS 基础知识有什么错误需要我知道吗?
谢谢!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>如果我认为您的需要是 First MainNavigationViewController 然后是 tabbarController ,并且每个标签栏的 ViewController 也有自己的导航 Controller ,那么它会正常工作..</p>
<pre><code>listViewController = [ initWithStyle:UITableViewStylePlain];
bookmarkController = [ initWithStyle:UITableViewStylePlain];
settingsController = [ init ];
searchController = [ initWithNibName:@"CBSearchViewController" bundle:nil];
nearbyController = [ init ];
UINavigationController *bNavigationController = [ initWithRootViewController:bookmarkController];
self.navigationControllerForBookmark = bNavigationController;
UITabBarItem *tab2=[init];
tab2.image = [ imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab2.selectedImage = [imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab2.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForBookmark.tabBarItem = tab2;
UINavigationController *cNavigationController = [ initWithRootViewController:settingsController];
self.navigationControllerForSettings = cNavigationController;
UITabBarItem *tab3=[init];
tab3.image = [ imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab3.selectedImage = [imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab3.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForSettings.tabBarItem = tab3;
UINavigationController *dNavigationController = [ initWithRootViewController:searchController];
self.navigationControllerForSearch = dNavigationController;
UITabBarItem *tab4=[init];
tab4.image = [ imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab4.selectedImage = [imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationController.tabBarItem = tab4;
tab4.imageInsets=UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForSearch.tabBarItem=tab4;
UINavigationController *eNavigationController = [ initWithRootViewController:nearbyController];
self.navigationControllerForNearby = eNavigationController;
UITabBarItem *tab5=[init];
tab5.image = [ imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab5.selectedImage = [imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.navigationController.tabBarItem = tab5;
tab5.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationControllerForNearby.tabBarItem = tab5;
forBarMetrics:UIBarMetricsDefault];
UINavigationController *aNavigationController = [ initWithRootViewController:listViewController];
self.navigationController = aNavigationController;
UITabBarItem *tab1=[init];
tab1.image = [ imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab1.selectedImage = [imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tab1.imageInsets = UIEdgeInsetsMake(5, 0, -5, 0);
navigationController.tabBarItem = tab1;
[ setBarTintColor:GRAY_COLOR];
self.tabBarController = [ init];
self.tabBarController.viewControllers = ;
self.window.rootViewController = self.tabBarController;
</code></pre>
<p>请检查这是否解决了您的问题,先生。</p></p>
<p style="font-size: 20px;">关于ios - UINavigationView 不能弹出,只有导航弹出动画,UIViewController 没变,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32430751/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32430751/
</a>
</p>
页:
[1]