美文网首页
6.区域监听

6.区域监听

作者: 流沙3333 | 来源:发表于2017-03-10 14:44 被阅读5次

@interface ViewController()

@property(nonatomic,strong)CLLocationManager* manager;

@end

@implementationViewController

- (void)viewDidLoad {

[superviewDidLoad];

// Do any additional setup after loading the view, typically from a

nib.

CLLocationManager*

manager = [[CLLocationManageralloc]init];

manager.delegate=self;

self.manager= manager;

//请求用户授权

//[_manager requestWhenInUseAuthorization];//这个不能实现区域监听

[_manager requestAlwaysAuthorization];

[_manager startUpdatingLocation];

NSLog(@"is = %i",[CLLocationManagerisMonitoringAvailableForClass:[CLCircularRegionclass]]);

CLLocationCoordinate2D center =CLLocationCoordinate2DMake(21.123,121.345);

CLCircularRegion*

region = [[CLCircularRegion alloc]initWithCenter:center radius:1000 identifier:@"lyb"];

[_manager startMonitoringForRegion:region];//开始监听

}

- (void)locationManager:(CLLocationManager*)manager didEnterRegion:(CLRegion*)region {

NSLog(@"%s",__func__);

}

- (void)locationManager:(CLLocationManager*)manager didExitRegion:(CLRegion*)region {

NSLog(@"%s",__func__);

}

@end

相关文章

  • 6.区域监听

    @interface ViewController() @property(nonatomic,strong)CL...

  • 回车 enter 键盘监听

    JS监听某个输入框 S监听某个DIV区域 JS监听body区域

  • 区域监听

    区域监听 1.概念解释 区 域 : 就是指划定的一块地域范围(比如圆形区域, 则由区域中心, 和半径组成) ...

  • 区域监听

    区域顾名思义是一个指定的区域,对其进行监听。先普及一下一点知识 前提:加载一张指南针图片,其他的#import <...

  • iOS 区域监听

    一、基本步骤 1.导入CoreLocation框架和对应的主头文件 #import

  • Swift区域监听

    监听代理

  • H5 实现下拉顶部放大

    1.监听整个下拉区域的touchstart事件,并记录下pageY和clientY值 2.监听整个区域的touch...

  • vue中使用watch监听$route 无效问题

    路由: 监听: 发现页面跳转时,并没有监听输出内容,就是没有监听到。路由组件的渲染区域为 router-view,...

  • IntersectionObserver的使用

    IntersectionObserver用来监听一个目标元素是否出现在web页面的可视区域。 传统方式监听一个元素...

  • JS实现滚动条触底加载更多

    原理 1.通过监听滚动区域DOM的scroll事件, 计算出触底 // 滚动可视区域高度 + 当前滚动位置 ===...

网友评论

      本文标题:6.区域监听

      本文链接:https://www.haomeiwen.com/subject/ixongttx.html