ios - UITableViewCell里的UIImageView添加点击事件无响应,求助。
伊谢尔伦
伊谢尔伦 2017-04-18 09:16:25
[iOS讨论组]

在 cellForRowAtIndexPath里定义cell

zhizhao为UIImageview,tapPhoto不管有无参数都没有任何响应。

代码如下:

 CAPictureViewCell *caCell=[[NSBundle mainBundle]loadNibNamed:@"CAPictureViewCell" owner:self options:nil][0];
        NSString *path = self.dic[@"imgpath"];
        [caCell.zhizhao setUserInteractionEnabled:YES];
        
        UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] init];
        [recognizer addTarget:self action:@selector(tapPhoto)];
        
        NSString* zhizhaoUrl = [path stringByAppendingString:self.dic[@"apliinfo"][@"business_licence_number_electronic"]];
        [caCell.zhizhao setImageWithURL:[NSURL URLWithString:zhizhaoUrl] placeholderImage:PLACEHOLDER];
        
        [caCell.zhizhao addGestureRecognizer:recognizer];
    
    
    viewDidLoad方法里:
    self.view.userInteractionEnabled = YES;
    self.infoTable.userInteractionEnabled = YES;
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(2)
迷茫

cell.zhozhao的允许交互方式要设置为yes。不过,你用拼音命名也是醉了。

大家讲道理

打断点看你设置userInteractionEnabled属性点时候视图初始化了没

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号