作者:蔡伟钊cc | 来源:互联网 | 2023-09-04 15:32
IamkindanewtoiPhonedevelopmentandhaventdoneanythingyetenvolvingtouches.Myviewhierar
I am kinda new to iPhone development and haven't done anything yet envolving touches. My view hierarchy like this:
我是iPhone开发的新手,并没有做任何有趣的事情。我的视图层次结构如下:
UIView - UIImageView - UIScrollView - CustomView
How do I detect if the user has tapped anywhere on the screen so I can show/hide the navigation bar accordingly? I don't need user interaction on my CustomView but I'd like to ignore touches on the UIScrollView when the user just wants to drag it.
如何检测用户是否点击了屏幕上的任何位置,以便我可以相应地显示/隐藏导航栏?我不需要在我的CustomView上进行用户交互,但是当用户只想拖动它时,我想忽略UIScrollView上的触摸。
I can already show/hide the navigation bar from my view controller programatically using:
我已经可以使用以下命令以编程方式显示/隐藏我的视图控制器中的导航栏:
[self.navigationController setNavigationBarHidden:YES animated:YES];
Thanks in advance!
提前致谢!
2 个解决方案