user520879
user520879

Reputation: 21

IPhone SDK calloutview replacement

i came across a code at this site: http://www.eidac.de/?p=183 that give the same function as the annotation in the MapKit, it works great when the label text of the annotation is short. However, when the text is long, the Uibutton is unclickabla, does anyone use the code an have the solution? thanks

Upvotes: 2

Views: 312

Answers (2)

Lee Armstrong
Lee Armstrong

Reputation: 11450

I have found this solution to be my favourite.

It lets you extend it and put images in there too!

http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/

Upvotes: 1

Julian Ceipek
Julian Ceipek

Reputation: 524

The layoutSubviews portion of CallOutView.m has bugs in it that make the CalloutView's frame too small (touch events don't get passed to the button because the button is outside of the view's bounds). While I think the function needs to be rewritten altogether, the easiest way to fix the problem is to delete the self.frame = frame; on line 186 and add the following to the end of the function.

frame.size.width = calloutLeft.frame.size.width + 
        calloutCenter.frame.size.width + calloutRight.frame.size.width + 
        calloutButton.frame.size.width + MIN_RIGHT_IMAGE_WIDTH;
self.frame = frame;

Upvotes: 1

Related Questions