German iOS custom Bubble add Click event Invalid issue

Source: Internet
Author: User

When developing with the high-D map SDK, you need to customize the bubble blow out box and find that the click event added by the bubble or the button is not responding.

Cause: The custom bubbles are added to the pin, and the size of the pin is only a small part below, so the Calloutview is outside the pin.
An IOS button that exceeds the parent view range is a handling method that cannot respond to events.

Workaround:

To override the HitTest method in CUSTOMANNOTATIONVIEW.M:

-(UIView *) HitTest: (cgpoint) point withevent: (Uievent *) Event {
UIView *view = [Super Hittest:point withevent:event];
if (view = = nil) {
Cgpoint tempoint = [Self.calloutView.navBtn convertpoint:point fromview:self];
if (Cgrectcontainspoint (Self.calloutView.navBtn.bounds, Tempoint))
{
view = Self.calloutView.navBtn;
}
}
return view;
}

The self.calloutView.navBtn here is the button you need to click

The pro-test is available.

German iOS custom Bubble add Click event Invalid issue

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.