Reputation: 225
I am using a collection view with custom cells. I don't know why but my cells stopped working (they don't call didSelect anymore).
Basically it's a simple cell that i'm just putting a view on top of it (addSubview). This view contains two imageViews and two labels.
I noticed that when i don't add this view, they do call didSelect. Isn't there a way to add a view on a UITableViewCell?
This is the code i'm using to add the view:
- (void)setCellWithMediaView:(TVNCategoryWideAndTallMediaView *)mediaView {
if (self.contentView.subviews.count > 0) {
[[self.contentView.subviews lastObject] removeFromSuperview];
}
self.categoryWideAndTallMediaView = [[TVNCategoryWideAndTallMediaView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.categoryWideAndTallMediaView = mediaView;
[self.contentView addSubview:self.categoryWideAndTallMediaView];
self.isMediaSet = YES;
}
Upvotes: 2
Views: 974
Reputation: 4279
You can set the userInteractionEnabled
property to NO
for that view and subviews.
self.categoryWideAndTallMediaView.userInteractionEnabled = NO;
Upvotes: 2