UserInteraction enable for subview only
问题 I have a view and view.UserInteractionenabled = no and a button is added to the view. i need to click the button only . is it possible to enable interaction for button only. 回答1: A view cannot receive touches unless userInteractionEnabled is YES for the view and all of its superviews up to the UIWindow object. You can make a subclass of UIView to contain the button, and make it ignore touches outside the button by overriding hitTest:withEvent: . Example: @interface MyView : UIView @property