[英]Scrolling in UITableView embedded in UITableviewCell (ios7)
I have UITableView
added as subview of UITableviewCell
. 我将
UITableView
添加为UITableviewCell
子视图。 In iOS 6 when I scroll internal tableView
and reach to the end of it main table view becomes scrolling. 在iOS 6中,当我滚动内部
tableView
并到达它的结尾时,主表视图变为滚动。 In iOS 7 it doesn't work anymore. 在iOS 7中它不再起作用。 If I am scrolling in internal table view it doesn't deliver this scroll event to parent tableView.
如果我在内部表视图中滚动它不会将此滚动事件传递给父tableView。
Does anyone know how to simply fix it, without manual transferring event from internal tableview to parent? 有没有人知道如何简单地修复它,而无需手动将事件从内部tableview转移到父级?
Additional info: I find possible reason of problem . 附加信息:我找到问题的可能原因。 But how to fix this problem.
但是如何解决这个问题。
So, I found a solution. 所以,我找到了解决方案。
According to tip from @FaisalAli I implement delegate method: 根据@FaisalAli的提示,我实现了委托方法:
- (BOOL) gestureRecognizer: (UIGestureRecognizer*)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer: (UIGestureRecognizer*)otherGestureRecognizer
{
if ([gestureRecognizer isKindOfClass: [UIPanGestureRecognizer class]])
{
if ([((UIPanGestureRecognizer*)gestureRecognizer) velocityInView: self].y > 0)
{
// Up
if (self.contentOffset.y <= 0)
{
self.bounces = NO;
return YES;
}
}
else
{
// Down
if (self.contentOffset.y + self.height >= self.contentSize.height)
{
self.bounces = NO;
return YES;
}
}
}
self.bounces = YES;
return NO;
}
And it helped. 它有所帮助。
I don't think that this is wise solution regarding ease of use for user. 我不认为这是关于用户易用性的明智解决方案。 You should use Master-Detail Strategy .
您应该使用Master-Detail Strategy 。
Set UINavigationController
as rootViewController, then push your Master TableViewController
, on selection of each cell you can push new TableViewController
having detailed data of selected Cell Item. 将
UINavigationController
设置为rootViewController,然后推送您的Master TableViewController
,在选择每个单元格时,您可以推送具有所选Cell Item详细数据的新TableViewController
。
Edit 编辑
If you really want to add TableView inside a TableViewCell then, please follow link 1 and link 2 . 如果你真的想在TableViewCell中添加TableView,请点击链接1和链接2 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.