To solve this situation I wrote a protocol for the subview:
@protocol MyViewDelegate <NSObject>
///
/// Tells the delegate that touches has begun in view
///
- (void)view:(UIView *)view didBeginDragging:(UIEvent *)event;
///
/// Tells the delegate that touches has finished in view
///
- (void)view:(UIView *)view didFinishDragging:(UIEvent *)event;
@end
Then I completed the UIResponder
methods in subview like this:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.delegate view:self didBeginDragging:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
self.frame = self.rootFrame;
[self.delegate view:self didFinishDragging:event];
}
Finally, I setup the cell as the delegate of the view and temporary cancel the cell selection while the dragging gestures are in progress:
- (void)view:(UIView *)view didBeginDragging:(UIEvent *)event {
[self setHighlighted:NO animated:NO];
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
}
- (void)vView:(UIView *)view didFinishDragging:(UIEvent *)event {
[self setSelectionStyle:UITableViewCellSelectionStyleGray];
}
That's it