まずは地図を表示して、現在位置にピンを立てるところまで。
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をプロパティに持つ:
rails>>
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>

@interface MapTutorialViewController : UIViewController {
MKMapView *_mapView;
}

@end
<<--

###Controller.mでMKMapViewを初期化
showsUserLocationをTRUEにすることで、現在の居場所にピンを立ててくれる。

rails>>

  • (void)viewDidLoad {
    [super viewDidLoad];

    _mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
    _mapView.showsUserLocation=TRUE;
    [self.view addSubview:_mapView];

<<--

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

posted by satoko satoko on Thu 3 Sep 2009 at 16:37 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
iphone開発gitIBInterfaceBuilderiOSSIMBLSnippetsterminaltwitterxcodeXcode4
Comments rssrss
guest guest: Muchos turistas buscan la mejor forma de llegar a ... 05/30 03:19
guest guest: San Antonio de Areco es conocido como la cuna de l... 05/27 19:47
https://rootskitchen.bar/ https://rootskitchen.bar/: Just had a solid session playing the crash format ... 05/18 17:27
guest guest: Optimizar el tiempo durante un viaje de negocios e... 05/18 00:46
https://foolsandkings.bar/ https://foolsandkings.bar/: Wrapped up a cracking night session grinding crash... 05/17 19:23
guest guest: Para muchos turistas, el transporte publico y la l... 05/15 18:22
https://safeedsautotransport.com/ https://safeedsautotransport.com/: Многие пользователи в Узбекистане интересуются, на... 05/13 14:36
evlnwyiyh evlnwyiyh: something new and exciting [url=http://www.gyxb4s... 05/08 11:27
Services from s21g
YOMU Web小説リーダー
小説投稿サイトの公式ページを開き、WebView表示と読み上げ向け表示を切り替えて、移動中や作業中にもWeb小説の続きを聴きやすくするiPhoneアプリです。
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。
jotter.me
個人開発者のためのホスティング一体型ノートサービス
ハンドミラー
iPhone向けの手鏡アプリ
ツイプロ(twpro)
Twitterプロフィールの高速検索エンジン