設置 百度地圖 的顯示的地圖中心 和縮放級別


 

- (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); }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM