zoukankan      html  css  js  c++  java
  • iphone JB开发小记(三)关于定位

     在ios5.x中springboard 默认定位有所改变,一般情况下好像是不开启的,需要手工调用私有api
    来开启执行。以使用百度地图的sdk为例,我们首先要打开系统自带的定位,才能使用定位功能。

    1 _locationManager = [[CLLocationManager alloc] init];
    2 _locationManager.delegate = self;
    3 if (![CLLocationManager locationServicesEnabled ]) {
    4         [CLLocationManager setLocationServicesEnabled:YES];
    5 }
    6 [_locationManager startUpdatingLocation];
    7 [_locationManager startMonitoringSignificantLocationChanges];

       通过上面的代码并实现相关的delegate可以开启定位功能,而如果需要使用百度的sdk,还需要
    调用百度的初始化操作。

     1 // 如果要关注网络及授权验证事件,请设定 generalDelegate 参 数
     2     if(!_mapManager)
     3     {
     4         _mapManager= [[BMKMapManager alloc]init];
     5         CLog(@"-------BaiduMap manager start-------");
     6         BOOL ret = [_mapManager start:@"你的服务码" generalDelegate:self];
     7         if (!ret) {
     8             CLog(@"-------BaiduMap manager start failed!-------");
     9         }
    10     }
    11     
    12     
    13     if(!_mapView)
    14     {
    15         _mapView= [[BMKMapView alloc] init];
    16         _mapView.delegate=self;
    17     }
    18     
    19     if(!_search)
    20     {
    21         _search = [[BMKSearch alloc] init];
    22         _search.delegate = self;
    23     }

      在系统api和百度地图的sdk,开启成功和初始化之后,就可以通过实现百度的委托,来调用定位和地址
    解析了,剩下的步骤和一般app没有差别。

  • 相关阅读:
    socket server的N种并发模型
    进程、线程以及Goroutine的区别
    分布式从ACID、CAP、BASE的理论推进
    epoll的理论与IO阻塞机制
    golang面试题知识点总结
    golang中如何进行项目模块及依赖管理
    面对golang中defer,要注意什么?
    Kaggle 学习之旅
    推荐在线学习读书网站
    k8s 的 dashboard 的实践
  • 原文地址:https://www.cnblogs.com/qiezi/p/2686508.html
Copyright © 2011-2022 走看看