{"id":439,"date":"2014-11-17T17:59:21","date_gmt":"2014-11-17T09:59:21","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=439"},"modified":"2016-07-14T18:21:05","modified_gmt":"2016-07-14T10:21:05","slug":"%e7%99%be%e5%ba%a6%e5%9c%b0%e5%9b%be%e4%bd%bf%e7%94%a8%e7%ac%ac%e5%9b%9b%e8%ae%b2%ef%bc%9a%e5%9c%b0%e5%9b%be%e5%b1%95%e7%a4%ba%e4%b8%8e%e5%ae%9a%e4%bd%8d","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/11\/17\/175921439.html","title":{"rendered":"\u767e\u5ea6\u5730\u56fe\u4f7f\u7528\u7b2c\u56db\u8bb2\uff1a\u5730\u56fe\u5c55\u793a\u4e0e\u5b9a\u4f4d"},"content":{"rendered":"<p>1\u3001\u52a0\u8f7d\u767e\u5ea6\u5730\u56fe<br \/>\n2\u3001\u5f00\u542f\u5b9a\u4f4d\u670d\u52a1<br \/>\n3\u3001\u5728\u5b9a\u4f4d\u670d\u52a1\u7684\u4ee3\u7406\u65b9\u6cd5\uff08\u83b7\u53d6\u7528\u6237\u5730\u7406\u4f4d\u7f6e\u540e\uff09\u4e2d\uff0c\u8bbe\u7f6e\u5730\u56fe\u4e2d\u5fc3\u70b9\u4e3a\u7528\u6237\u5f53\u524d\u4f4d\u7f6e<br \/>\n4\u3001\u76f8\u5173\u8bf4\u660e\u53ca\u4ee3\u7801\u5b9e\u73b0\uff1a<!--more--><\/p>\n<pre lang=\"objc\" line=\"1\">\/\/\n\/\/  SAViewController.m\n\/\/  MapDemo\n\/\/\n\/\/  Created by Sian on 14\/11\/13.\n\/\/  Copyright (c) 2014\u5e74 Sian. All rights reserved.\n\/\/\n\n#import \"SAViewController.h\"\n#import \"BMapKit.h\"\n\n@interface SAViewController () <BMKMapViewDelegate, BMKLocationServiceDelegate>\n\n@property (nonatomic, strong) BMKMapView            *mapView;\n\n@property (nonatomic, strong) BMKLocationService    *location;\n\n@end\n\n@implementation SAViewController\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    \n    \/\/ \u521d\u59cb\u5316\u5b9a\u4f4d\u670d\u52a1\n    self.mapView = [[BMKMapView alloc] initWithFrame:self.view.frame];\n    self.mapView.delegate = self;\n    \/\/ \u663e\u793a\u7528\u6237\u5f53\u524d\u4f4d\u7f6e\n    self.mapView.showsUserLocation = YES;\n    [self.view addSubview:self.mapView];\n    \n    \/\/ \u521d\u59cb\u5316\u5b9a\u4f4d\u670d\u52a1\n    self.location = [[BMKLocationService alloc] init];\n    self.location.delegate = self;\n    \/\/ \u5f00\u542f\u5b9a\u4f4d\u670d\u52a1\n    [self.location startUserLocationService];\n\n}\n\n- (void)viewWillAppear:(BOOL)animated\n{\n    [super viewWillAppear:animated];\n    [self.mapView viewWillAppear];\n}\n\n- (void)viewWillDisappear:(BOOL)animated\n{\n    [super viewWillDisappear:animated];\n    [self.mapView viewWillDisappear];\n}\n\n#pragma mark \u4ee3\u7406\u65b9\u6cd5\u83b7\u53d6\u7528\u6237\u4f4d\u7f6e\u4fe1\u606f\u65f6\u8c03\u7528\n- (void)didUpdateUserLocation:(BMKUserLocation *)userLocation\n{\n    NSLog(@\"%f\", userLocation.location.horizontalAccuracy);\n    \/\/ \u5730\u56fe\u52a0\u8f7d\u7528\u6237\u4f4d\u7f6e\u56fe\u5c42\n    [self.mapView updateLocationData:userLocation];\n    \/\/ \u5c06\u7528\u6237\u5f53\u524d\u4f4d\u7f6e\u8bbe\u7f6e\u4e3a\u5730\u56fe\u4e2d\u5fc3\u70b9\n    self.mapView.centerCoordinate = userLocation.location.coordinate;\n    \/\/ \u8bbe\u7f6e\u5730\u56fe\u7f29\u653e\u6bd4\u4f8b\n    self.mapView.zoomLevel = 17;\n}\n@end<\/pre>\n<p>\u6548\u679c\u5c55\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.yusian.com\/blog\/wp-content\/uploads\/2016\/07\/iOS-\u6a21\u62df\u5668\u5c4f\u5e55\u5feb\u7167\u201c2014\u5e7411\u670820\u65e5-\u4e0a\u534810.22.28\u201d.jpg\" alt=\"iOS-\u6a21\u62df\u5668\u5c4f\u5e55\u5feb\u7167\u201c2014\u5e7411\u670820\u65e5-\u4e0a\u534810.22.28\u201d\" width=\"320\" height=\"480\" class=\"alignnone size-full wp-image-440\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u52a0\u8f7d\u767e\u5ea6\u5730\u56fe 2\u3001\u5f00\u542f\u5b9a\u4f4d\u670d\u52a1 3\u3001\u5728\u5b9a\u4f4d\u670d\u52a1\u7684\u4ee3\u7406\u65b9\u6cd5\uff08\u83b7\u53d6\u7528\u6237\u5730\u7406\u4f4d\u7f6e\u540e\uff09\u4e2d\uff0c\u8bbe\u7f6e\u5730\u56fe\u4e2d\u5fc3\u70b9\u4e3a\u7528\u6237\u5f53\u524d\u4f4d\u7f6e 4\u3001\u76f8\u5173\u8bf4\u660e\u53ca\u4ee3\u7801\u5b9e\u73b0\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[13],"class_list":["post-439","post","type-post","status-publish","format-standard","hentry","category-project","tag-bdmap"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=439"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/439\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}