UITabbar 在另一个 UIView 下仍然处于活动状态
我的屏幕上有一个 TabBar 和一个带有一些按钮的视图。单击按钮时,我创建一个 ViewController(带有笔尖的视图)并将其添加到应用程序的键窗口。我将此视图放在屏幕外并启动动画,使这个新视图从屏幕底部滑动,并覆盖 tabBar。在这个新视图上有一个 UIPicker 和 2 个按钮(选择/取消)。当单击此按钮之一时,PickerView 会滑出屏幕,并且其控制器将被释放。
除了一件事之外,这工作正常:如果我单击 tabBar 所在的区域并被我的新视图隐藏,则 tabBar 会收到单击事件!
如何让 tabBar 不响应? (请记住,我不会推送新视图)或者这可能不是正确的方法?
编辑&解答:问题来自于我在高度设置上犯了错误。我输入了 160 而不是 260。 [myPickerController.view setFrame:CGRectMake(0, 480, 320, 260)]; 最后 100 像素,即使显示,对事件“透明”并传输到位于该区域的 TabBar(即使它被隐藏)。
I have a TabBar on the screen and a View with some buttons on it. When a button is clicked, I create a ViewController (with a view from a nib) and add it to the keywindow of the application. I put this view offscreen and start an animation to make this new view slides from the bottom of the screen, and cover the tabBar. On this new view there is a UIPicker and 2 buttons (select / cancel). When one of this buttons is clicked, the PickerView slide off the screen and his controller is dealloc.
This works fine except for one thing : if I click on the zone where the tabBar is located and hidden by my new view, the tabBar get the click event !
How can I make the tabBar non responsive ? (Remember that I don't push the new view) Or maybe it isn't the right way to do this ?
EDIT & ANSWER : The problem came from the fact that I did a mistake in the height setting. I typed 160 instead of 260.
[myPickerController.view setFrame:CGRectMake(0, 480, 320, 260)];
The last 100 px, even if displayed, where "transparent" to event and get transfered to the TabBar who stands in that zone (even if it was hidden).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定,但你为什么不在
视图可见时尝试一下。确保您设置了
何时关闭视图。
I am not sure but why don't you try
when the view is visible. Make sure you set
when view is dismissed.
您应该使用应用程序中命名的方法:
You should use method named in your application: