10.5 コーディング
それではコーディングに入ります。本アプリはすべてExtension側に実装していますので、iOSアプリのAppDelegate、ViewControllerにはプログラムコードが何もありません。
10.5.1 初期化部分
次は初期化部分のコードです。
@interface InterfaceController() {
CLLocationManager *locationManager; // ロケーションマネージャ
CLLocationCoordinate2D userLocation; // 現在位置
BOOL deferredLocationUpdates; // Deferrdアップデートフラグ
CLLocationCoordinate2D mapCenterLocation; // 地図の中心位置
MKCoordinateSpan span; // 地図の表示範囲
float spanValue; //
NSTimer *intervalTimer; // 地図の更新タイマー
}
// 地図オブジェクト
@property (weak, nonatomic) IBOutlet WKInterfaceMap *mapView;
@end
@implementation InterfaceController
- (void)awakeWithContext:(id)context {
[super awakeWithContext:context];
// ユーザーに位置情報利用の承諾を得る
l
この記事は会員限定です。会員登録をすると続きをお読みいただけます。
ログイン / 新規登録