The documentation doesn't talk much about it, and there seems to be no init method for this? How would I create one and set the longitude and latitude or region to display in the map view?
+1
A:
Interface builder includes the MKMapView (Map View). Drag the element into your XIB, add a referencing outlet in your controller, link them up. Then, set the region. Lots of good examples:
Kevin Sylvestre
2010-06-25 07:06:21
I want to do that programmatically. Not using nibs...
dontWatchMyProfile
2010-06-25 07:39:37
You should be able to allocate and initialize the view using 'initWithFrame' (in UIView documentation), then add the view to the parent view as a subview.
Kevin Sylvestre
2010-06-25 20:57:41
A:
You can include MKMapView both by code or by Interface builder.
For Interface builder just drag it & drop it to your xib.(Tools->Library->MapView)
By code
//In your .h file
MKMapView * mapView;
//in your .m file
-(void)viewWillAppear:(BOOL)animated {
self.mapView = [[[MKMapView alloc] initWithFrame:
self.view.frame] autorelease];
[self.view addSubview:self.mapView];
}
raaz
2010-06-25 07:40:32