I have a custom UITableViewCell (.h, .m, .xib) registered in a UITableView.
Now i need to use a custom UIImage inside the cell and attach to it a Gesture Recognizer (I can't use a UIButton). The problem is that if it at runtime I get a
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'invalid nib registered for identifier (CustomCell) -
nib must contain exactly one top level object which must be a UITableViewCell instance'
If i remove the gesture the cell works correctly, i believe it's a cocoa bug, i will now try to instantiate it programmatically, but i guess the problem is that the gesture recognizer is on the same herarchy level of the TableViewCell in the xib
do you know other interface builder workaround?
Enabling user interaction on the UIImage and adding programmatically a gesture recognizer in the awakeFromNib works
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleImageTap:)];
tap.cancelsTouchesInView = YES;
tap.numberOfTapsRequired = 1;
tap.delegate = self;
[self.imagePicture addGestureRecognizer:tap];
But i'd like to know the reason why it is not working rather. I will wait to accept.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With