【问题标题】:how to use the gps in google map in objective-c如何在objective-c中使用谷歌地图中的gps
【发布时间】:2010-05-12 12:57:49
【问题描述】:

我想使用谷歌地图中的 gps 自动定位用户当前位置。 是 mapkit 框架,objective-c 中用于 iphone 的 gps。

【问题讨论】:

    标签: iphone gps


    【解决方案1】:

    在 viewDidLoad 中 写

    self.locationManager = [[[CLLocationManager alloc] init] autorelease];
    self.locationManager.delegate = self; // Tells the location manager to send updates to this object
    
    self.mapView.delegate = self;
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    [self.locationManager startUpdatingLocation];
    

    然后 实施

    - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
    

    委托方法 newLocation 将是用户的位置

    locationManager 是 CLLocationManager * locationManager;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-23
      • 2019-06-23
      • 1970-01-01
      • 2017-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多