Override the following methods in the parent view where the button resides.
In the following example, I added two buttons outside the parent view callbtn and DETAILBTN;
The following example scenario is a custom bubble view in the. Gold map. Because the bubble view is added by default on the Pin view. In general, the size of the pin view is much smaller than the bubble view and the bubble view is all outside the pin view. Unable to respond to click events.
-(UIView *) HitTest: (cgpoint) point withevent: (uievent *) event {
UIView *view = [super hitTest:p oint withevent: event]; Get the view of the response event first by normal method
if (view = = Nil) {
cgpoint TEMPOINTCALLBTN = [self. Calloutview. Callbtn convertpoint:p oint fromview :self
cgpoint TEMPOINTDETAILBTN = [self. Calloutview. Detailbtn convertpoint:p oint fromview:self;//If you want to judge multiple buttons, add the corresponding points multiple times according to this rule. After the IF statement, add the corresponding else if judgment.
if (cgrectcontainspoint(self). Calloutview. Callbtn. Bounds, TEMPOINTCALLBTN)//Determine if the location of the current click is in the view we want to respond to.
{
View = self. Calloutview. CALLBTN;//If the judge is true, return the view we want to respond to.
} Else if (cgrectcontainspoint( self). Calloutview. Detailbtn. Bounds, tempointdetailbtn)) {
View = self. Calloutview. DETAILBTN;
}
}
return view;
}
In iOS, if the position of the button exceeds the parent view, it cannot respond. How do I handle it?