设置 百度地图 的显示的地图中心 和缩放级别

 

- (void)viewDidLoad {
    NSLog(@"进入GRailwayController.m的viewDidLoad方法");
    [super viewDidLoad];

    zoomLevel = 3.0f;//启动BMKMapManager
    bmkMapManager = [[BMKMapManager alloc]init];
    BOOL ret = [bmkMapManager start:@"2772BD5CAFF652491F65707D6D5E9ABEBF3639CC" generalDelegate:self];
    if (!ret) {
        NSLog(@"manager start faile d!");
    }
    
    //创建一张百度地图
    _mapView = [[BMKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
    _mapView.delegate = self;
    [webView addSubview:_mapView];
    
    mapCenterLat = 35.91039f;
    mapCenterLon = 116.89017f;
    [self setMapCenter];
//初始化自定义的气泡view
    bubbleView = [[KYBubbleView alloc] initWithFrame:CGRectMake(0, 0, 160, 40)];
    bubbleView.hidden = YES;
    
    dataArray = [[NSMutableArray alloc] initWithCapacity:10];
}
-(void)setMapCenter //设置地图的中心位置 { mapCenterCoordinate.latitude = mapCenterLat; mapCenterCoordinate.longitude = mapCenterLon; [_mapView setRegion:BMKCoordinateRegionMake(mapCenterCoordinate,BMKCoordinateSpanMake(zoomLevel,zoomLevel))]; NSLog(@"=========%f,%f,%f",mapCenterLat,mapCenterLon,zoomLevel); }

 

posted @ 2013-05-22 13:37  ygm900  阅读(20691)  评论(0编辑  收藏  举报