iOS开发学习之MapKit

1.包含MapKit框架(参考包含官方框架博文)

2.添加MapView控件和IBOut属性,并在storyboard连接两者(包括delegate,即让MapView所在的视图控制器成为该控件的delegate)

@property (nonatomic, weak) IBOutlet MKMapView *mapView; 

3. 在地图上显示用户当前的位置

    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(self.mapView.userLocation.coordinate, 1000, 1000);

    [self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];

posted @ 2016-06-09 16:39  XuDeHong  阅读(130)  评论(0编辑  收藏  举报