zoukankan      html  css  js  c++  java
  • iOS.定位服务与地图应用.05.跟踪用户位置变化

    #import <UIKit/UIKit.h>
    #import <MapKit/MapKit.h>
    
    @interface T20140621000000ViewController : UIViewController<MKMapViewDelegate>
    
    @property (weak, nonatomic) IBOutlet MKMapView *mapView;
    
    @end
    #import "T20140621000000ViewController.h"
    
    @interface T20140621000000ViewController ()
    
    @end
    
    @implementation T20140621000000ViewController
    
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        
        if ([CLLocationManager locationServicesEnabled])
        {
            _mapView.mapType = MKMapTypeStandard;
            _mapView.delegate = self;
            _mapView.showsUserLocation = YES;
            [_mapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
        }
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
    }
    
    
    
    #pragma mark -
    #pragma mark Map View Delegate Methods
    - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
    {
        _mapView.centerCoordinate = userLocation.location.coordinate;
    }
    
    - (void)mapViewDidFailLoadingMap:(MKMapView *)theMapView withError:(NSError *)error
    {
        NSLog(@"error : %@",[error description]);
    }
    
    
    @end
  • 相关阅读:
    java 类的关系
    Oracle lock table
    shell 标准输出重定向
    pygame 安装
    进程检查机制
    oracle pivot unpivot
    qt paintEvent
    centos7.5+Ambari2.7.3部署安装
    Linux机器间配置ssh互信
    普通视图和物化视图的区别
  • 原文地址:https://www.cnblogs.com/cqchen/p/3802257.html
Copyright © 2011-2022 走看看