回答編集履歴

2

修正

2017/01/29 10:39

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -81,3 +81,7 @@
81
81
  }
82
82
 
83
83
  ```
84
+
85
+
86
+
87
+ ![s](e226205fe60021c9866355b74b4d9b28.png)

1

修正

2017/01/29 10:39

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -19,3 +19,65 @@
19
19
 
20
20
 
21
21
  [Yahoo! iOSマップSDKをSwiftで使ってみる](http://qiita.com/k-yamada@github/items/1826b31bc9a55eea10be)
22
+
23
+
24
+
25
+ 準備ができていれば以下のコードだけで地図が表示できます。
26
+
27
+
28
+
29
+ ```swift
30
+
31
+ import UIKit
32
+
33
+
34
+
35
+ class ViewController: UIViewController, YMKMapViewDelegate {
36
+
37
+ var map: YMKMapView?
38
+
39
+
40
+
41
+ override func viewDidLoad() {
42
+
43
+ super.viewDidLoad()
44
+
45
+ // YMKMapViewのインスタンスを作成
46
+
47
+ map = YMKMapView(frame: CGRect(x: 0, y: 0, width: 320, height: 320), appid: "アプリケーションID")
48
+
49
+
50
+
51
+ // 地図のタイプを指定 標準の地図を指定
52
+
53
+ map!.mapType = UInt(YMKMapTypeStandard)
54
+
55
+
56
+
57
+ // YMKMapViewを追加
58
+
59
+ self.view = map!
60
+
61
+
62
+
63
+ // YMKMapViewDelegateを登録
64
+
65
+ map!.delegate = self
66
+
67
+
68
+
69
+ // 地図の位置と縮尺を設定
70
+
71
+ var center = CLLocationCoordinate2D.init();
72
+
73
+ center.latitude = 35.6657214;
74
+
75
+ center.longitude = 139.7310058;
76
+
77
+ map!.region = YMKCoordinateRegionMake(center, YMKCoordinateSpanMake(0.002, 0.002));
78
+
79
+ }
80
+
81
+ }
82
+
83
+ ```