Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select tablecell when touching embedded view

I have a custom tablecell with an embedded MapView showing a small area. When the user selects the cell, I want to push a new view with a larger mapview and some more information, like distance from where you are, option of what map-type etc.

If I leave a small margin around my mapview, the user can click in that margin to select the cell, but how can I make the cell selected if they click inside the mapview?

regards,
-Vegar

like image 929
Vegar Avatar asked Feb 02 '26 14:02

Vegar


2 Answers

I think you need to override the hitTest method inherited from UIView

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event

This method traverses the view hierarchy by sending the pointInside:withEvent: message to each subview to determine which subview should receive a touch event. If pointInside:withEvent: returns YES, then the subview’s hierarchy is traversed; otherwise, its branch of the view hierarchy is ignored. You rarely need to invoke this method, but you might override it to hide touch events from subviews.

like image 133
willcodejavaforfood Avatar answered Feb 04 '26 04:02

willcodejavaforfood


Try set MapView's userIteractionEnabled property to NO

like image 33
Vladimir Avatar answered Feb 04 '26 03:02

Vladimir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!