我刚接触Objective C,所以这可能是一个微不足道的问题:
初始化位置后:
CLLocation *currentPoint = [[CLLocation alloc] initWithLatitude:0 longitude:0]:稍后如何更改纬度和经度?
发布于 2009-07-30 20:26:08
CLLocation对象是不可变的(您不能更改它们)。根据文档:
通常,您使用CLLocationManager对象根据用户设备的最后已知位置创建此类的实例。但是,如果您想缓存自定义位置数据或获取两个不同坐标点之间的距离,则可以自己创建实例。
发布于 2011-10-11 17:03:42
以下是如何修改CLLocation的示例:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation{
newLocation = [[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(newLocation.coordinate.latitude, -1.1874988592864875)
altitude:newLocation.altitude
horizontalAccuracy:newLocation.horizontalAccuracy
verticalAccuracy:newLocation.verticalAccuracy
timestamp:newLocation.timestamp] autorelease];下面是如何创建新CLLotation的另一个示例:
CLLocation *newLocation = [[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(41.44994138650804, -1.1874988592864875)
altitude:0
horizontalAccuracy:0
verticalAccuracy:0
timestamp:[NSDate date]] autorelease];https://stackoverflow.com/questions/1209084
复制相似问题