単純な地図アプリを作っているのですが、シミュレータの挙動が毎回違うのはバグでしょうか?
具体的には次のような挙動をします
-
縮尺の度合いが世界地図レベルから近所の駅がわかるくらいのレベルに違う
-
freeway driveをすると拡大しようとして最初に戻る→拡大しようとして・・・を繰り返す。いつのまにかちゃんと拡大されてる
-
freeway driveで正常に拡大された後に縮小や拡大をしてもすぐに元の縮尺に戻る
Swift
1class ViewController: UIViewController ,MKMapViewDelegate,CLLocationManagerDelegate{ 2 @IBOutlet weak var mapView: MKMapView! 3 4 let locationManager = CLLocationManager() 5 6 override func viewDidLoad() { 7 super.viewDidLoad() 8 //mapViewからイベントを取得 9 mapView.delegate = self 10 11 mapView.frame = self.view.frame 12 self.view.addSubview(mapView) 13 14 //CLLocationManagerからイベントを取得 15 locationManager.delegate = self 16 //位置情報の更新 17 locationManager.startUpdatingLocation() 18 19 } 20 21 22 func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { 23 print("位置情報取得 成功") 24 25 26 //マップのコード 27 //表示タイプを地図に設定 28 mapView.mapType = MKMapType.standard 29 30 //回転を無効 31 mapView.isRotateEnabled = false 32 33 //ユーザーの位置をマップに表示する 34 mapView.showsUserLocation = true 35 36 //ユーザー追跡モード アニメーション 37 mapView.userTrackingMode = MKUserTrackingMode.follow 38 39 //mapViewのセンターにユーザーの位置を設定 40 mapView.setCenter(mapView.userLocation.coordinate, animated: false) 41 42 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/28 00:58
2018/05/28 08:35
2018/05/28 08:51
2018/05/28 12:13