首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >隐藏后,TabBar不能触摸TabBar后面的区域

隐藏后,TabBar不能触摸TabBar后面的区域
EN

Stack Overflow用户
提问于 2014-08-27 23:17:07
回答 1查看 1.3K关注 0票数 6

我在我的应用程序上使用TabBarController,在一个主要视图(aViewController)中,我推送另一个控制器(bViewController),并使用self.tabBarController.tabBar.hidden=YES隐藏TabBar;

bViewController在tabBar所在的地方有一个按钮,它不会捕捉触摸事件。

我尝试将按钮放置在bViewController的不同位置,而tabBar应该位于的区域是唯一没有检测到触摸事件的地方。

我尝试过在bViewController之外使用tabBarController,它工作得很好。任何帮助都将不胜感激。

编辑:

当我按下aViewController上的按钮时,我会打电话

代码语言:javascript
复制
self.tabBarController.tabBar.hidden=YES;
[self performSegueWithIdentifier:@"aViewToBView" sender:self];

aViewToBview是在故事板上声明的推送单元。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-24 00:54:41

由于某些原因,您不能触摸选项卡栏下的视图。

但是,如果您隐藏选项卡栏,然后向其添加一个子视图,则该视图可以接收用户交互!

这对我起了作用:

代码语言:javascript
复制
// Create a button that is at the very bottom of the screen
CGFloat buttonHeight = 45.0f;
UIButton *finishButton = [[UIButton alloc] initWithFrame:CGRectMake(
          0, 
          self.view.frame.size.height - self.tabBarController.tabBar.frame.size.height - buttonHeight,
          self.view.frame.size.width,
          buttonHeight)];
//...more initialization of the button...

//Here is our solution:
[self.tabBarController.view addSubview:finishButton];
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25538410

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档