[size=large][b] //显示当前位置的代码[/b][/size]
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
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