标签:com http class blog style div img code java javascript log
// // ViewController.m // mapdemo001 // // Created by apple on 14-4-28. // Copyright (c) 2014年 apple. All rights reserved. // #import "ViewController.h" #import <MapKit/MapKit.h> @interface ViewController () <MKMapViewDelegate> { MKMapView *_mapview; } @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. MKMapView *mapview = [[MKMapView alloc] initWithFrame:self.view.bounds]; mapview.delegate = self; mapview.showsUserLocation = YES; [self.view addSubview:mapview]; } - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { if (_mapview) { return; } //设置中心位置 [mapView setCenterCoordinate:userLocation.location.coordinate]; //设置跨度 MKCoordinateSpan span = MKCoordinateSpanMake(0.102988, 0.078449); //显示区域 MKCoordinateRegion region = MKCoordinateRegionMake(userLocation.location.coordinate, span); //设置显示区域 [mapView setRegion:region animated:YES]; _mapview = mapView; } - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated { NSLog(@"%f %f",mapView.region.span.latitudeDelta,mapView.region.span.longitudeDelta); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end
标签:com http class blog style div img code java javascript log
原文地址:http://www.cnblogs.com/damao2012/p/3698064.html