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
  • 相关阅读:
    AJAX需要注意的
    SEO 搜索引擎优化
    jQuery 插件
    CSS BFC和IE Haslayout
    jQuery 插件开发
    jQuery Ajax
    jQuery 工具函数
    jQuery 动画效果
    jQuery 高级事件
    jQuery 事件对象
  • 原文地址:https://www.cnblogs.com/cqchen/p/3802257.html
Copyright © 2011-2022 走看看