ios - 为什么从 popviewcontroller 到另一个 View 时启用了我的 Tabbar 的用户交互?
<p><p>如果我错了,请检查我的代码。</p>
<p>我的应用程序第一次启动时一切都很好</p>
<blockquote>
<p>tabBars.tabBar.userInteractionEnabled=NO;</p>
</blockquote>
<p>此代码运行良好意味着我的标签栏 userInteraction 已关闭。但是我会转到另一个 View 并简单地使用 <code>popViewController</code> 并首先查看我的 userInteraction 已启用,为什么?
我找不到这个问题。</p>
<pre><code>EATabBarVC *tabBars = [ init];
UIImage *tabBarImage = ;
UIImageView *imageView = [ initWithImage:tabBarImage];
imageView.frame = CGRectMake(self.view.frame.origin.x, 0, self.view.frame.size.width, tabBars.tabBar.frame.size.height);
;
tabBars.tabBar.userInteractionEnabled=NO;
;
tabBars.tabBar.tintColor = ;
tabBars.tabBar.tintColor = ;
tabBars.navigationController.navigationBarHidden = YES;
NSMutableArray *localViewControllersArray = [ initWithCapacity:3];
EAHomeVC *objEAHomeVC = [ init];
UINavigationController *dashboardNavController = [ initWithRootViewController:objEAHomeVC];
dashboardNavController.navigationBar.hidden = YES;
EAScanLeadsVC *objEAScanLeadsVC = [ init];
objEAScanLeadsVC.delegate = self;
objEAScanLeadsVC.tabBarItem.titlePositionAdjustment = UIOffsetMake(0.0, -3.0);
if (IS_IPHONE6PLUS) {
objEAScanLeadsVC.tabBarItem.titlePositionAdjustment = UIOffsetMake(0.0, -6.0);
}
if (IS_IPADAIR2||IS_IPADMINI) {
objEAScanLeadsVC.tabBarItem.titlePositionAdjustment = UIOffsetMake(0.0, -12.0);
}
,NSFontAttributeName : ROBOTOLIGHT(5.39*2.2)}
forState:UIControlStateNormal];
,NSFontAttributeName : ROBOTOLIGHT(5.39*2.2) }
forState:UIControlStateSelected];
UINavigationController *scanNavController = [ initWithRootViewController:objEAScanLeadsVC];
//scanNavController.title = @"Scan Lead";
scanNavController.tabBarItem.titlePositionAdjustment = UIOffsetMake(0.0, -3.0);
if (IS_IPHONE6PLUS) {
scanNavController.tabBarItem.titlePositionAdjustment = UIOffsetMake(0.0, -6.0);
}
if (IS_IPADAIR2||IS_IPADMINI) {
scanNavController.tabBarItem.titlePositionAdjustment = UIOffsetMake(0.0, -12.0);
}
,NSFontAttributeName : ROBOTOLIGHT(5.39*2.2) }
forState:UIControlStateNormal];
,NSFontAttributeName : ROBOTOLIGHT(5.39*2.2) }
forState:UIControlStateSelected];
highlightImage:];
;
;
tabBars.viewControllers = localViewControllersArray;
tabBars.view.autoresizingMask=(UIViewAutoresizingFlexibleHeight);
tabBars.navigationController.navigationBar.hidden = YES;
;
,NSFontAttributeName : ROBOTOLIGHT(5.39*2.2) }
forState:UIControlStateNormal];
,NSFontAttributeName : ROBOTOLIGHT(5.39*2.2) }
forState:UIControlStateSelected];
return [
initWithRootViewController:tabBars];
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>添加此代码可能会有所帮助。</p>
<pre><code>- (void)viewWillAppear:(BOOL)animated
{
[[[items]objectAtIndex:0]setEnabled:FALSE];
[[[items]objectAtIndex:1]setEnabled:FALSE];
}
- (void)viewDidAppear:(BOOL)animated
{
[[[items]objectAtIndex:0]setEnabled:FALSE];
[[[items]objectAtIndex:1]setEnabled:FALSE];
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 为什么从 popviewcontroller 到另一个 View 时启用了我的 Tabbar 的用户交互?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/40107416/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/40107416/
</a>
</p>
页:
[1]