I’ve been spending a few hours messing around with the MapKit part of the iPhone 3.0 SDK. I was able to easily get a scrollable google map up and running pretty quickly and then mess with rendering my own content on top of it. I need to be able to place multiple markers around the map, but I don’t want to use map annotations for all of them because the pins just look horrible. They’re fine for user locations, but pins everywhere just looks bad, plus they’re only available in red, green, and purple. So, I’m drawing my own markers on top of the map and that seems to be working well for the most part.
Going to keep messing with it for a bit and see if it’s definitely a piece of the sdk I want to continue to use.
3 Responses for "iPhone MapKit…"
I don’t suppose you would be willing to release some of your “work in progress”. I have been playing with the mapkit and completely agree about the pins.
I may put together some info on the mapping code I ended up writing.
Do you know that you can use your own image for an annotation? You need to check out the delegate methods for the mapview…
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation {
MKAnnotationView *thisAnnotationView = [ [ MKAnnotationView alloc ] initWithAnnotation:annotation reuseIdentifier:@”whateverIdentifier” ];
thisAnnotationView.image = [ UIImage imageNamed:@"whateverImage.png" ];
/*
CGPoint offsetPixels;
offsetPixels.x = 11;
offsetPixels.y = -thisAnnotationView.image.size.height/2;
thisAnnotationView.centerOffset = offsetPixels;
*/
return thisAnnotationView;
}
This works perfectly…you’ll notice I commented a section of code out. I used that to center my image appropriately. You’ll need to do this since by default it centers the image on the point you want, and you’ll want most images to be above the point.
Leave a reply