tags:

views:

20

answers:

2

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:

http://developer.apple.com/iphone/library/samplecode/WorldCities/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009466

Kevin Sylvestre
I want to do that programmatically. Not using nibs...
dontWatchMyProfile
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
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