ios 手动添加mapview

1,首先选中Build Phases ,在Link Binary With Libraries 下添加MapKit.framework框架

2,在头文件(.h文件)处添加:#import <MapKit/MapKit.h>

3,如果需要定位到你当前的位置,该类还需要遵循 :<MKMapViewDelegate>

4,声明MKMapView对象:

  MKMapView *mapView = [[MKMapViewalloc]initWithFrame:[UIScreenmainScreen].applicationFrame];

    mapView.showsUserLocation = YES;

    mapView.mapType = MKMapTypeStandard;

    [view addSubview:mapView];

 

posted @ 2014-03-11 19:17  shidaying  阅读(171)  评论(0编辑  收藏  举报