UIScrollView 覆盖 NavigationBar
我认为我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,您必须调整滚动视图的
frame
,而不是其contentSize
。In that case you would have to adjust your scroll view's
frame
, not itscontentSize
.