OC

Knowledge OS
主帖 9 条回复

有人知道怎么使用ios CLLocationManagerDelegate的协议里的几个方法怎么写啊?

Reese Reese · 2014年02月28日 · 无人欣赏。
- (void)locationManager:(CLLocationManager *)manager
  didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region
-(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

这三个协议,不知道该怎么实现才能实现地理围栏的功能呢?

回复

9 条
#3
Reese
2014年02月28日

1楼 @tinyfool 没找到例子,看说明是说,用第一个方法决定state来调用第二个和第三个,在第一个方法中实现requestStateForRegion之后,应该可以得到当前的region,然后利用这个region来判断state,我该如何判断这个request的region和我开始设定的一个myRegion一样或者接近呢?总不能使用isEqual吧?

#6
Reese
2014年03月01日

5楼 @tinyfool 试了一下,并且在 - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region 方法里加了个localNotification,可是貌似没有用呀。。。不知道 CLLocationManager何时才回调用这个方法呢?

#8
Reese
2014年03月02日

7楼 @prepostrous 真的吗?我找找看啊,找了半天没有找到啊,是在 CLLocationManagerDelegate协议文档里的那个related source code吗?

#9
Reese
2014年03月02日

7楼 @prepostrous 找到了哈~~~多谢~~~只读了delegate协议的文档,刚看了cllocationmanager的文档,找到了哈~

登录 或者 注册