美文网首页
关于tableview添加到self.view时,点击cell无

关于tableview添加到self.view时,点击cell无

作者: PokerFace_u | 来源:发表于2017-05-09 18:31 被阅读117次

tableview添加到最下面时点击最下面的cell没反应,(如果下面有按钮,可能会穿透到下面的按钮去)是因为tabbar隐藏后,self.view的高度不是到最下面,tableview添加到self.view时,造成最后两行cell无反应,解决办法,在viewdidload中改变self.view的frame成全屏,解决。


问题2 当tableview和scrollview是同一级别,都加到self.view上面时,手势造成

冲突,如何解决?


- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event

{

NSLog(@"touchesBegan");

CGPoint point = [[touches anyObject] locationInView:self.view];

point = [coverView.chooseLocationView.layer convertPoint:point fromLayer:self.view.layer];

NSLog(@"point--x==%f,point-y=%f",point.x,point.y);

if (coverView.hidden==NO) {

if ([coverView.chooseLocationView.layer containsPoint:point]) {

NSLog(@"点击了coverView.chooseLocationView");

mainScrollView.userInteractionEnabled = NO;

commitBtn.userInteractionEnabled = NO;

mainScrollView.scrollEnabled = NO;

}

else if(point.y<=0)

{

NSLog(@"点击了coverView的上部分");

}

}

else

{

point = [mainScrollView.layer convertPoint:point fromLayer:coverView.chooseLocationView.layer];

if ([mainScrollView.layer containsPoint:point]) {

NSLog(@"点击了mainScrollView");

mainScrollView.userInteractionEnabled = YES;

commitBtn.userInteractionEnabled = YES;

mainScrollView.scrollEnabled = YES;

}

}

}

相关文章

网友评论

      本文标题:关于tableview添加到self.view时,点击cell无

      本文链接:https://www.haomeiwen.com/subject/aojitxtx.html