まずは地図を表示して、現在位置にピンを立てるところまで。
MKMap-1.png

via

http://blog.objectgraph.com/index.php/2009/04/02/iphone-sdk-30-playing-with-map-kit/

MapKit.frameworkを追加する

MapKit.png

Controller.hでMapKit/MapKit.hをImport

MapKit/MapKit.hをImportして、MKMapViewをプロパティに持つ:

   1  #import <UIKit/UIKit.h>
   2  #import <MapKit/MapKit.h>
   3  
   4  @interface MapTutorialViewController : UIViewController {
   5  	MKMapView *_mapView;
   6  }
   7  
   8  @end

Controller.mでMKMapViewを初期化

showsUserLocationをTRUEにすることで、現在の居場所にピンを立ててくれる。

   1  - (void)viewDidLoad {
   2      [super viewDidLoad];
   3  
   4  	_mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
   5  	_mapView.showsUserLocation=TRUE;
   6  	[self.view addSubview:_mapView];

実機でやると、地図は出るが現在位置に近い地図でないので??ですが、それはまた次で。

posted by Png satoko on Thu 3 Sep 2009 at 16:37
Contents
[iPhone] Map Kitで遊ぼう:地図を出して現在位置にピンを立てる
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ