我在我的应用程序上使用TabBarController,在一个主要视图(aViewController)中,我推送另一个控制器(bViewController),并使用self.tabBarController.tabBar.hidden=YES隐藏TabBar;
bViewController在tabBar所在的地方有一个按钮,它不会捕捉触摸事件。
我尝试将按钮放置在bViewController的不同位置,而tabBar应该位于的区域是唯一没有检测到触摸事件的地方。
我尝试过在bViewController之外使用tabBarController,它工作得很好。任何帮助都将不胜感激。
编辑:
当我按下aViewController上的按钮时,我会打电话
self.tabBarController.tabBar.hidden=YES;
[self performSegueWithIdentifier:@"aViewToBView" sender:self];aViewToBview是在故事板上声明的推送单元。
发布于 2014-12-24 00:54:41
由于某些原因,您不能触摸选项卡栏下的视图。
但是,如果您隐藏选项卡栏,然后向其添加一个子视图,则该视图可以接收用户交互!
这对我起了作用:
// 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];https://stackoverflow.com/questions/25538410
复制相似问题