HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – didSelectRowAtIndexPath没有被调用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在UITableViewCell中添加了UIScrollView,但是当我点击滚动视图时,确实没有调用SELEct方法.
-(void)tableView:(UITableView *)tableView didSELEctRowATindexPath:(NSIndexPath *)indexPath

我在cellView的contentView上添加滚动视图,仍然没有调用SELEct方法.

[cell.contentView addSubview:scrollView];

解决方法

因为ScrollView重叠在Cell上…最好的方法是在UIScrollView上添加tap Gesture,比如
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@SELEctor(gestureAction:)];
[recognizer setnumberOfTapsrequired:1];
MYScrollView.userInteractionEnabled = YES;
[MYScrollView addGestureRecognizer:recognizer];

在cellForRowATindexPath方法和Write手势动作方法添加上面的代码就好了

-(void)gestureAction:(UITapGestureRecognizer *) sender
{
    CGPoint touchLOCATIOn = [sender LOCATIOnOfTouch:0 inView:self.YourTableViewName];
    NSIndexPath *indexPath = [self.YourTableViewName indexPathForRowAtPoint:touchLOCATIOn];

    NSLog(@"%d",indexPath.row);
}

在上面的gesture(action)方法中,您可以将indexPath与didSELEctRowATindexPath相同.

大佬总结

以上是大佬教程为你收集整理的ios – didSelectRowAtIndexPath没有被调用全部内容,希望文章能够帮你解决ios – didSelectRowAtIndexPath没有被调用所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。