UI中地图的使用
2015-09-23 16:06
351 查看
@interface ViewController (){ CLLocationManager *manager; }@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib.manager = [[CLLocationManager alloc]init]; [manager requestAlwaysAuthorization]; MKMapView *mapView = [[MKMapView alloc]initWithFrame:self.view.bounds]; mapView.delegate = self; mapView.mapType = MKMapTypeStandard; CLLocationCoordinate2D center = {39.9115696831,116.2396262413}; MKCoordinateSpan span = {0.1, 0.1}; MKCoordinateRegion region = {center, span}; [mapView setRegion:region animated:YES]; mapView.showsUserLocation = YES; [self.view addSubview:mapView]; }#pragma mark-MKMapViewDelegate- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{ NSLog(@"view:%@",view);}- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{ NSLog(@"userLocation:%@",userLocation);}- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{ NSLog(@"annotation:%@",annotation); return nil;}
相关文章推荐
- Android IPC进程间通讯机制
- fastjson处理接口时的一个问题
- C#中实现Fluent Interface的三种方法
- c#中的interface abstract与virtual介绍
- 领悟php接口中interface存在的意义
- Python ljust rjust center输出
- C#接口interface用法实例
- PHP abstract与interface之间的区别
- C#接口(Interface)用法分析
- PHP SPL标准库之接口(Interface)详解
- go语言中的interface使用实例
- Python multiprocessing.Manager介绍和实例(进程间共享数据)
- Go语言interface详解
- LINUX6不能启动,bringing up interface eth0:
- 使用 golang 收集系统指标
- 使用微软Traffic Manage---实验
- Hadoop 离线安装 CDH5.1 第二章:cloudera manager与agent 安装
- 51CTO下载-千万级大型系统集成项目
- 烂泥:【转】rsync命令参数详解
- VMWare: eth0: error fetching interface information : device not found