代码之家  ›  专栏  ›  技术社区  ›  zebra

mkreversegeocoder和计时器

  •  0
  • zebra  · 技术社区  · 14 年前

    我已经阅读过,使用mkreversegeocoder,我可以每60秒进行一次查询。 我对mkreversegeogoder的距离是在cllocation检索到一些信息后开始的。 60秒查询的最佳方式是什么?计时器?或者玩我以前约会的时间戳?或者其他的东西? 谢谢

    2 回复  |  直到 14 年前
        1
  •  0
  •   Vladimir    14 年前

    在任意延迟间隔后,可以使用reversegeocoder例程调用选择器 NSObject's

    - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay
    
        2
  •  0
  •   zebra    14 年前

    嗯,我不是舒尔,我知道怎么用……有点像

    - (void) onceGeocoding:(CLLocationManager *)manager didUpdateToLocation:(CLLocation  
    *)newLocation
    fromLocation:(CLLocation *)oldLocation  {
    self.geoCoder = [[[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate] autorelease];
    geoCoder.delegate = self;
    [geoCoder start];
    NSLog(@"myTimer started");
    }
    

    这是我的选择器,我用

    [self performSelector:@selector(onGeocoding:) withObject:nil afterDelay:60.0];
    

    ?