相关疑难解决方法(0)

如何检测UITableViewCellStyleSubtitle样式中UITableViewCell对象的UIImageView上的触摸

我正在使用 样式中的UITableViewCell对象UITableViewCellStyleSubtitle(即左侧的图像视图,粗体的文本标签以及详细文本标签下的文本标签)来创建我的表格.现在我需要检测触摸UIImageView并且还要知道单击图像视图的索引路径/单元格.我试过用

cell.textLabel.text = @"Sometext";
NSString *path = [[NSBundle mainBundle] pathForResource:@"emptystar1" ofType:@"png"];
UIImage *theImage = [UIImage imageWithContentsOfFile:path];
cell.imageView.image = theImage;
cell.imageView.userInteractionEnabled = YES; 
Run Code Online (Sandbox Code Playgroud)

但它不起作用.每当点击图像时,都会didSelectRowAtIndexPath:被调用.我不想创建一个单独的UITableViewCell并添加自定义按钮.有没有办法检测UIImageView自己的触摸?

cocoa-touch objective-c uitableview uiimageview

30
推荐指数
4
解决办法
4万
查看次数