为什么 BMKMapView实例化程序就崩溃
比拉米 2014-03-11 09:54:18 想使用百度地图,但是根据网上的教程,只要为 BMKMapView实例化程序就崩溃
代码如下
- (void)viewDidLoad
{
[super viewDidLoad];
_mapViewS = [[BMKMapView alloc] initWithFrame:CGRectMake(0, 39, 320, 377)]; //创建MKMapView 崩溃
[self.view addSubview:_mapViewS];
//[_mapViewS release];
_mapViewS.delegate = self;
//设置代理
_mapViewS.showsUserLocation = YES; //设置为可以显示用户位置
CLLocationCoordinate2D coordinate; //设定经纬度
coordinate.latitude = 40.027283; //纬度
coordinate.longitude = 116.313217; //经度
BMKCoordinateRegion viewRegion = BMKCoordinateRegionMake(coordinate, BMKCoordinateSpanMake(1.0, 1.0));
BMKCoordinateRegion adjustedRegion = [_mapViewS regionThatFits:viewRegion];
[_mapViewS setRegion:adjustedRegion animated:YES];
// Do any additional setup after loading the view from its nib.
}