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

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条回复
tinyfool 回复于 2014年02月28日

看过文档和里面的例子了么?

xieweizhi007 回复于 2014年02月28日

看方法名应该不难推出什么意思吧????

Reese 回复于 2014年02月28日

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

Reese 回复于 2014年02月28日

2楼 @xieweizhi007 知道是什么意思,就是不是很会用呀,还不熟练。

tinyfool 回复于 2014年02月28日

3楼 @Reese 那你就试试看吧

Reese 回复于 2014年03月01日

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

prepostrous 回复于 2014年03月02日

6楼 @Reese 官方文档里不是有demo么....这样的Q 各个论坛应该都有帖的。

Reese 回复于 2014年03月02日

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

Reese 回复于 2014年03月02日

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

登录 或者 注册
相关帖子