質問編集履歴

3

URLを追加しました

2019/03/12 02:36

投稿

corecore
corecore

スコア12

test CHANGED
File without changes
test CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  [GMSMapViewDelegateのリファレンス](https://developers.google.com/maps/documentation/ios-sdk/reference/protocol_g_m_s_map_view_delegate-p.html#ae291e1bff99f9d06428ced09daf5802d)
12
12
 
13
+ [Google Maps SDK for iOS の使い方(Swift 4対応)](https://qiita.com/koogawa/items/adc2dd19015586bda39b#マーカーを追加してみる)
14
+
13
15
  を参考にしてコードを書き換えましたがTappedCircleが呼ばれません。
14
16
 
15
17
 

2

コードの修正

2019/03/12 02:36

投稿

corecore
corecore

スコア12

test CHANGED
File without changes
test CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Google Maps SDK for iOSを利用して地図上に円を描いて、その円をタップすると画面遷移するようにしたいと思い、公式のドキュメントを参考にして下のようなコードを書いたのですが、サークルをタップしても何も動きません。どこが間違っているのでしょうか?
4
4
 
5
+ ######追加
6
+
7
+ 何度もすみません
8
+
9
+ [デリゲートの使い方](https://techacademy.jp/magazine/15055)
10
+
11
+ [GMSMapViewDelegateのリファレンス](https://developers.google.com/maps/documentation/ios-sdk/reference/protocol_g_m_s_map_view_delegate-p.html#ae291e1bff99f9d06428ced09daf5802d)
12
+
13
+ を参考にしてコードを書き換えましたがTappedCircleが呼ばれません。
14
+
5
15
 
6
16
 
7
17
  ######問題点
@@ -97,3 +107,97 @@
97
107
  }
98
108
 
99
109
  ```
110
+
111
+ ###修正後のコード
112
+
113
+ ```swift
114
+
115
+ import UIKit
116
+
117
+ import GoogleMaps
118
+
119
+ import CoreLocation
120
+
121
+
122
+
123
+ class ViewController: UIViewController, GMSMapViewDelegate{
124
+
125
+
126
+
127
+ override func viewDidLoad() {
128
+
129
+ super.viewDidLoad()
130
+
131
+ // Do any additional setup after loading the view, typically from a nib.
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ // map
140
+
141
+
142
+
143
+ let camera = GMSCameraPosition.camera(withLatitude: 35.687396, longitude: 139.743924, zoom: 17)
144
+
145
+ let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
146
+
147
+ mapView.delegate = self
148
+
149
+ self.view = mapView
150
+
151
+ // mapView.isMyLocationEnabled
152
+
153
+
154
+
155
+ let circle = GMSCircle()
156
+
157
+ circle.position = CLLocationCoordinate2DMake(35.687396, 139.743924)
158
+
159
+ circle.radius = CLLocationDistance(10)
160
+
161
+ circle.fillColor = UIColor.blue
162
+
163
+ //
164
+
165
+ circle.isTappable = true
166
+
167
+ circle.map = mapView
168
+
169
+
170
+
171
+
172
+
173
+ }
174
+
175
+
176
+
177
+ override func didReceiveMemoryWarning() {
178
+
179
+ super.didReceiveMemoryWarning()
180
+
181
+ // Dispose of any resources that can be recreated.
182
+
183
+ }
184
+
185
+
186
+
187
+ func TappedCircle(_ mapView: GMSMapView, didTapOverlay: GMSOverlay) -> Bool {
188
+
189
+ performSegue(withIdentifier: "goTalk", sender: nil)
190
+
191
+ return true
192
+
193
+ }
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ }
202
+
203
+ ```

1

問題点を追加しました

2019/03/12 01:47

投稿

corecore
corecore

スコア12

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,10 @@
3
3
  Google Maps SDK for iOSを利用して地図上に円を描いて、その円をタップすると画面遷移するようにしたいと思い、公式のドキュメントを参考にして下のようなコードを書いたのですが、サークルをタップしても何も動きません。どこが間違っているのでしょうか?
4
4
 
5
5
 
6
+
7
+ ######問題点
8
+
9
+ 地図とサークルは表示されるのですが、タップしても反応しません
6
10
 
7
11
 
8
12