首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

展示当前位置及设置区域 CLLocation

2012-09-02 
显示当前位置及设置区域 CLLocation//显示当前位置的代码mapView.showsUserLocationYESCLLocationManage

显示当前位置及设置区域 CLLocation
//显示当前位置的代码
    mapView.showsUserLocation=YES;
    CLLocationManager *locationManager=[[CLLocationManager alloc]init];
    locationManager.delegate=self;
    locationManager.desiredAccuracy=kCLLocationAccuracyHundredMeters;
    locationManager.distanceFilter=1000.0f;
    [locationManager startUpdatingLocation];   
    MKCoordinateSpan theSpan;
    theSpan.latitudeDelta=0.01;
    theSpan.longitudeDelta=0.01;
    MKCoordinateRegion theRegion;
    theRegion.center=[[locationManager location]coordinate];
    theRegion.span=theSpan;
    [mapView setRegion:theRegion];





调用safari生成地图 :
   
//    NSString *url = @"http://openapi.baidu.com/map/examples/map-mobile.html";
//    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
//    [webView loadRequest:request];
   
  //  [[UIApplication sharedApplication]openURL:[[NSURL alloc]initWithString:@"http://maps.google.com"]]; 调用safari
   

热点排行