简体   繁体   English

2 UIScrollView中的UITableView

[英]2 UITableView in a UIScrollView

I have a UIScrollView with 2 pages in my app and each page has a UITableView with some rows in it. 我的应用程序中有一个带有2个页面的UIScrollView ,每个页面都有一个UITableView有一些行。 The problem is that the touches are really weird. 问题是接触真的很奇怪。 If I want to go to the second page while i am on the first one, i would simply swipe to the left from the right to go to the other page but the UITableView detects the swipe as a vertical swipe and "takes" the touch. 如果我想在第一页上转到第二页,我只需从右侧向左滑动即可转到另一页但是UITableView会将滑动检测为垂直滑动并“触摸”触摸。 I have to try 3-4 times to be successfully able to go to the other page. 我必须尝试3-4次才能成功转到另一页。 This is very annoying and I was wondering if somebody had a way to make the touches better. 这非常烦人,我想知道是否有人有办法让接触更好。

Thanks in advance. 提前致谢。 :) :)

如果要锁定滚动视图:

scrollView.scrollEnabled = NO;

你可以保持定制的滚动条滚动视图...所以用户将从滚动条滚动......和ofcource如果你在滚动视图中插入表视图然后有两个委托滚动和其他表现在如何你将控制两者......我认为它不好......所以让它们中的任何一个自定义,这样你就可以得到它想要的控制器......而且最好的是我们一直保持自定义滚动条bcoz它的编码的外部部分。 ...

try setting directionalLockEnabled property of scrollBar. 尝试设置scrollBar的directionalLockEnabled属性。

self.scrollBar.directionalLockEnabled = YES; self.scrollBar.directionalLockEnabled = YES;

Keep the frame.height of scroll bar equal to tableview.frame.height. 保持滚动条的frame.height等于tableview.frame.height。

Set the directional lock property for tableView. 为tableView设置方向锁属性。

self.tableView.directionalLockEnabled = YES;

当你移动页面时,只需make (UITableView)tblView.userInteractionEnabled = NO ,所以它调用UIScrollView的触摸事件。

足以使滚动正常

scrollViewContainer.delaysContentTouches = NO;

More way to lock the scrollview. 更多方法来锁定scrollview。

1) 1)

scrollViewContainer.delaysContentTouches = NO;

2) 2)

scrollView.scrollEnabled = NO;

3) 3)

self.scrollBar.directionalLockEnabled = YES;

Like this.......I hope this is helpful for you. 像这样......我希望这对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM