2011年10月13日

加入最簡單的Map View

在viewDidLoad中加入

MKMapView *mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
self.myMapView = mapView;
[mapView release];
self.myMapView.mapType = MKMapTypeStandard;
self.myMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.myMapView];

Bear in mind that a delegate for a map view is not a required object, meaning that you can create map views without assigning delegates to them; these views simply won’t respond to user manipulation.

0 意見:

張貼意見