質問編集履歴
3
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,11 +90,11 @@
|
|
90
90
|
|
91
91
|
func mapView(mapView: YMKMapView!, viewForAnnotation annotation: YMKAnnotation!) -> YMKAnnotationView! {
|
92
92
|
|
93
|
-
|
93
|
+
print("pin")
|
94
94
|
|
95
95
|
if annotation is MyAnnotation {
|
96
96
|
|
97
|
-
|
97
|
+
|
98
98
|
|
99
99
|
// マーカーのビューを引数のannotationを用いて作成する
|
100
100
|
|
2
コードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,11 +22,79 @@
|
|
22
22
|
|
23
23
|
```ここに言語を入力
|
24
24
|
|
25
|
+
class MapViewController: UIViewController,YMKMapViewDelegate {
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
var mapView: YMKMapView?
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
override func viewDidLoad() {
|
34
|
+
|
35
|
+
super.viewDidLoad()
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
// YMKMapViewのインスタンスを作成
|
40
|
+
|
41
|
+
mapView = YMKMapView(frame: CGRect(x: 0, y: 0, width: 320, height: 320), appid: “アプリID”)
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
// 地図のタイプを指定 標準の地図を指定
|
46
|
+
|
47
|
+
mapView!.mapType = UInt(YMKMapTypeStandard)
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
// YMKMapViewを追加
|
52
|
+
|
53
|
+
self.view = mapView!
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
// YMKMapViewDelegateを登録
|
58
|
+
|
59
|
+
mapView!.delegate = self
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
// 地図の位置と縮尺を設定
|
64
|
+
|
65
|
+
var center = CLLocationCoordinate2D.init();
|
66
|
+
|
67
|
+
center.latitude = 35.6657214;
|
68
|
+
|
69
|
+
center.longitude = 139.7310058;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
mapView!.region = YMKCoordinateRegionMake(center, YMKCoordinateSpanMake(1, 1));
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
//ピン表示
|
78
|
+
|
79
|
+
let coordinate = CLLocationCoordinate2D(latitude: 35.6657214, longitude: 139.7310058)
|
80
|
+
|
81
|
+
let myAnnotation = MyAnnotation(locationCoordinate: coordinate, title: "ミッドタウン", subtitle: "ミッドタウンです。")
|
82
|
+
|
83
|
+
map?.addAnnotation(myAnnotation)
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
25
91
|
func mapView(mapView: YMKMapView!, viewForAnnotation annotation: YMKAnnotation!) -> YMKAnnotationView! {
|
26
92
|
|
27
93
|
|
28
94
|
|
29
95
|
if annotation is MyAnnotation {
|
96
|
+
|
97
|
+
print("pin")
|
30
98
|
|
31
99
|
// マーカーのビューを引数のannotationを用いて作成する
|
32
100
|
|
@@ -34,7 +102,7 @@
|
|
34
102
|
|
35
103
|
//アイコンイメージの変更
|
36
104
|
|
37
|
-
pin?.image = UIImage.init(named: "i
|
105
|
+
pin?.image = UIImage.init(named: "route_pin.png");
|
38
106
|
|
39
107
|
pin?.animatesDrop = true
|
40
108
|
|
1
スペースの削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
|
5
|
+
|
6
6
|
|
7
7
|
|
8
8
|
|