ios - Prevent UITableViewCell selection when dragging a subview -
i have uitableviewcell
subclass , have added uiview
contentview
property. in order enable dragging subview, have implemented uiresponder
appropriate methods:
- (void)touchesmoved:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint currentlocation = [touch locationinview:self.superview]; if (currentlocation.x >= self.rootframe.origin.x) { return; } cgrect frame = self.frame; frame.origin.x = currentlocation.x; self.frame = frame; } - (void)touchesended:(nsset *)touches withevent:(uievent *)event { self.frame = self.rootframe; // rootframe copy of initial frame } - (void)touchescancelled:(nsset *)touches withevent:(uievent *)event { [self touchesended:touches withevent:event]; }
the subview can dragged without problem, cell being selected well, -tableview:didselectrowatindexpath:
being called.
how can prevent cell becomes selected when subview being dragged?
-[uitableviewcell setselectionstyle: uitableviewcellselectionstylenone]
of course, tableview:didselectrowatindexpath:
still called - might want ignore callback selectively.
Comments
Post a Comment