Showing posts with label MKMapViewDelegate. Show all posts
Showing posts with label MKMapViewDelegate. Show all posts

Tuesday, September 21, 2010

<Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0

There seems to be a bug in iOS 4.0 built-in MapKit, which causes error message in both simulator and real device:
<Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0.
This happens when I open UIViewController, which contains MKMapView (all created with Interface Builder). Since user location is not needed at this moment, I just unchecked "Shows User Location" checkbox on Map View Attributes.

Warning disappears and I'm back on Zero Warning policy!

Tuesday, May 25, 2010

How to Create Custom Map Annotation Button

Custom accessory button for MKPinAnnotationView right side, create inside MKMapViewDelegate protocol mapView:viewForAnnotation method:
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 20, 20)];
[button setImage:[UIImage imageNamed:@"myButton.png"] forState:UIControlStateNormal]; 
view.rightCalloutAccessoryView = button;
Usually sample codes use UIButtonTypeDetailDisclosure as right button, but you can't use that unless you really show additional details. For anything else, you must use a custom button.