UIScrollView 覆盖 NavigationBar

发布于 2024-11-02 20:53:13 字数 996 浏览 2 评论 0原文

我认为我的 ScrollView 位于导航栏上方。
因为我的后退按钮不起作用,而是调用了我的函数“handleTouchesOne”。 我想我必须调整滚动视图的 contentSize 的高度,但我做错了。

scrollView.pagingEnabled = YES;
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * kNumberOfPages, scrollView.frame.size.height);
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.scrollsToTop = NO;
scrollView.delegate = self;
scrollView.directionalLockEnabled = YES;

希望有人能帮助我!

编辑:我如何初始化我的点击手势:

// One finger single tap

tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTouchesOne:)];
tapGesture.cancelsTouchesInView = NO; 
tapGesture.delaysTouchesEnded = NO;
tapGesture.numberOfTouchesRequired = 1; // One finger single tap
tapGesture.numberOfTapsRequired = 1;
//tapGesture.delegate = self;
[self.view addGestureRecognizer:tapGesture];
[tapGesture release];

是否该按钮不起作用,因为视图位于导航栏上方或只是将我的点击链接到我的功能?

i think my ScrollView is located over my navigation bar.
Because my back button doesn't work and instead my function "handleTouchesOne" is called.
I think i have to adjust the height of the scrollView's contentSize but i am doing something wrong.

scrollView.pagingEnabled = YES;
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * kNumberOfPages, scrollView.frame.size.height);
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.scrollsToTop = NO;
scrollView.delegate = self;
scrollView.directionalLockEnabled = YES;

Hope someone can help me!

edit: how i init my tap gesture:

// One finger single tap

tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTouchesOne:)];
tapGesture.cancelsTouchesInView = NO; 
tapGesture.delaysTouchesEnded = NO;
tapGesture.numberOfTouchesRequired = 1; // One finger single tap
tapGesture.numberOfTapsRequired = 1;
//tapGesture.delegate = self;
[self.view addGestureRecognizer:tapGesture];
[tapGesture release];

Could it be, that the button does not work because the view is over the nav bar or just links my tap to my function ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

定格我的天空 2024-11-09 20:53:13

在这种情况下,您必须调整滚动视图的 frame,而不是其 contentSize

In that case you would have to adjust your scroll view's frame, not its contentSize.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文