質問編集履歴

3

画像の追加

2017/02/01 10:42

投稿

mokumoku
mokumoku

スコア46

test CHANGED
File without changes
test CHANGED
@@ -149,3 +149,9 @@
149
149
  }
150
150
 
151
151
  ```
152
+
153
+
154
+
155
+ ・現状の表示
156
+
157
+ ![イメージ説明](767c95f7ffa9b1d5c6ba871d1652a9ad.png)

2

コードの追記

2017/02/01 10:42

投稿

mokumoku
mokumoku

スコア46

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,125 @@
27
27
  Yahoo! iOSマップSDKドキュメント
28
28
 
29
29
  ・[アイコンを表示する](http://developer.yahoo.co.jp/webapi/map/openlocalplatform/v1/iphonesdk/tutorial4.html)
30
+
31
+
32
+
33
+ ```ここに言語を入力
34
+
35
+ import UIKit
36
+
37
+
38
+
39
+
40
+
41
+ class MyAnnotation: NSObject, YMKAnnotation {
42
+
43
+ private(set) var coordinate: CLLocationCoordinate2D
44
+
45
+ var annotationTitle: String?
46
+
47
+ var annotationSubtitle: String?
48
+
49
+
50
+
51
+ init(locationCoordinate coord: CLLocationCoordinate2D, title annTitle: String?, subtitle annSubtitle: String?) {
52
+
53
+ coordinate = coord
54
+
55
+ annotationTitle = annTitle
56
+
57
+ annotationSubtitle = annSubtitle
58
+
59
+
60
+
61
+ }
62
+
63
+
64
+
65
+ func title() -> String? {
66
+
67
+ return annotationTitle
68
+
69
+
70
+
71
+ }
72
+
73
+
74
+
75
+ func subtitle() -> String? {
76
+
77
+ return annotationSubtitle
78
+
79
+
80
+
81
+ }
82
+
83
+
84
+
85
+ }
86
+
87
+
88
+
89
+ class ViewController: UIViewController,YMKMapViewDelegate {
90
+
91
+ var map: YMKMapView?
92
+
93
+
94
+
95
+ override func viewDidLoad() {
96
+
97
+ super.viewDidLoad()
98
+
99
+
100
+
101
+ // YMKMapViewのインスタンスを作成
102
+
103
+ map = YMKMapView(frame: CGRect(x: 0, y: 0, width: 320, height: 320), appid: "アプリID")
104
+
105
+
106
+
107
+ // 地図のタイプを指定 標準の地図を指定
108
+
109
+ map!.mapType = UInt(YMKMapTypeStandard)
110
+
111
+
112
+
113
+ // YMKMapViewを追加
114
+
115
+ self.view = map!
116
+
117
+
118
+
119
+ // YMKMapViewDelegateを登録
120
+
121
+ map!.delegate = self
122
+
123
+
124
+
125
+ // 地図の位置と縮尺を設定
126
+
127
+ var center = CLLocationCoordinate2D.init();
128
+
129
+ center.latitude = 35.6657214;
130
+
131
+ center.longitude = 139.7310058;
132
+
133
+
134
+
135
+ map!.region = YMKCoordinateRegionMake(center, YMKCoordinateSpanMake(0.002, 0.002));
136
+
137
+
138
+
139
+ //ピン1個表示
140
+
141
+ let coordinate = CLLocationCoordinate2D(latitude: 35.6657214, longitude: 139.7310058)
142
+
143
+ let myAnnotation = MyAnnotation(locationCoordinate: coordinate, title: "ミッドタウン", subtitle: "ミッドタウンです。")
144
+
145
+ map?.addAnnotation(myAnnotation)
146
+
147
+
148
+
149
+ }
150
+
151
+ ```

1

コードの削除、実現したいことの記入

2017/02/01 08:22

投稿

mokumoku
mokumoku

スコア46

test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,12 @@
12
12
 
13
13
 
14
14
 
15
+ 実現したいこととしては、
16
+
17
+ "Yahoo! iOSマップSDKをSwiftで使ってみる"の地図の表示に、複数の任意の場所にアイコンを表示させるといったことをSwift3対応で実装したいと考えております。
18
+
19
+
20
+
15
21
  ベースは下記の"Yahoo! iOSマップSDKをSwiftで使ってみる"を参考にしています。
16
22
 
17
23
  ・[Yahoo! iOSマップSDKをSwiftで使ってみる](http://qiita.com/k-yamada@github/items/1826b31bc9a55eea10be)
@@ -21,27 +27,3 @@
21
27
  Yahoo! iOSマップSDKドキュメント
22
28
 
23
29
  ・[アイコンを表示する](http://developer.yahoo.co.jp/webapi/map/openlocalplatform/v1/iphonesdk/tutorial4.html)
24
-
25
- ```Objective-C
26
-
27
- //YMapKitTestAppDelegate.m
28
-
29
-
30
-
31
- //アイコンの緯度経度を設定
32
-
33
- CLLocationCoordinate2D coordinate;
34
-
35
- coordinate.latitude = 35.665818701569016;
36
-
37
- coordinate.longitude = 139.73087297164147;
38
-
39
- //MyAnnotationの初期化
40
-
41
- MyAnnotation* myAnnotation = [[MyAnnotation alloc] initWithLocationCoordinate:coordinate title:[[NSString alloc] initWithString:@"ミッドタウン"] subtitle:[[NSString alloc] initWithString:@"ミッドタウンです。"]];
42
-
43
- //AnnotationをYMKMapViewに追加
44
-
45
- [map addAnnotation:myAnnotation];
46
-
47
- ```