7.2 Handling the Events of a Map View
2014-03-17 09:43
381 查看
如何处理事件
在苹果的世界里,当然是delegate
self.myMapView.delegate =
self;
@protocol MKMapViewDelegate;
@interface ViewController :
UIViewController<MKMapViewDelegate>
@end
-(void)test7_1
{
self.view.backgroundColor = [UIColor
whiteColor];
self.myMapView = [[MKMapView
alloc]
initWithFrame:self.view.bounds];
/* Set the map type to Satellite */
self.myMapView.mapType
= MKMapTypeStandard;
self.myMapView.autoresizingMask
= UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
/* Add it to our view */
self.myMapView.delegate =
self;
[self.view
addSubview:self.myMapView];
}
- (void)viewDidLoad
{
[super
viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self
test7_1];
}
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
- (void)mapViewWillStartRenderingMap:(MKMapView *)mapView
NS_AVAILABLE(10_9,
7_0)
{
NSLog(@"%s",__FUNCTION__);
}
输出:
2014-03-17 09:42:39.240 cookbook[365:a0b] -[ViewController mapView:regionWillChangeAnimated:]
2014-03-17 09:42:39.241 cookbook[365:a0b] -[ViewController mapView:regionDidChangeAnimated:]
2014-03-17 09:42:39.258 cookbook[365:a0b] -[ViewController mapViewWillStartRenderingMap:]
在苹果的世界里,当然是delegate
self.myMapView.delegate =
self;
@protocol MKMapViewDelegate;
@interface ViewController :
UIViewController<MKMapViewDelegate>
@end
-(void)test7_1
{
self.view.backgroundColor = [UIColor
whiteColor];
self.myMapView = [[MKMapView
alloc]
initWithFrame:self.view.bounds];
/* Set the map type to Satellite */
self.myMapView.mapType
= MKMapTypeStandard;
self.myMapView.autoresizingMask
= UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
/* Add it to our view */
self.myMapView.delegate =
self;
[self.view
addSubview:self.myMapView];
}
- (void)viewDidLoad
{
[super
viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self
test7_1];
}
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
- (void)mapViewWillStartRenderingMap:(MKMapView *)mapView
NS_AVAILABLE(10_9,
7_0)
{
NSLog(@"%s",__FUNCTION__);
}
输出:
2014-03-17 09:42:39.240 cookbook[365:a0b] -[ViewController mapView:regionWillChangeAnimated:]
2014-03-17 09:42:39.241 cookbook[365:a0b] -[ViewController mapView:regionDidChangeAnimated:]
2014-03-17 09:42:39.258 cookbook[365:a0b] -[ViewController mapViewWillStartRenderingMap:]
相关文章推荐
- ecshop的模板文件中如何判断用户是否登录
- Cascade:HIbernate中级联的使用
- meanShift算法介绍
- Java中的Enum的使用与分析
- 双色LED灯一些特性研究
- 怎样用VB自动更新应用程序
- js 捕获浏览器关闭或者刷新页面给出提示
- codeforce 402A - Nuts
- iptables配置
- java中的单例模式和工厂模式举例:
- Compass
- NSString用法总结
- 【懒懒】我不生产笑话,我只是笑话的搬运工 [问题点数:200分]
- SQL Server 常用SQL总结
- 解决炉石传说战网无法更新问题
- 【grunt整合版】30分钟学会使用grunt打包前端代码
- Sinatra+SQLite3+DataMapper - 十分完整的tutorial - “Superdo”
- JSON基础笔记
- 我的第一个博客
- RedHat yum安装配置藏