0
私は高架道路アニメーションを作りたいアップルMapkit
https://developer.apple.com/videos/play/wwdc2015/206/ 上WWDCセッションを見ては31:33でした。カメラの角度を上から下に変えて回転させます。しかし、私はいくつかのコードを書いた、それはクラッシュします。私の助けを借りて、私のコードに間違っていることを教えてください、ありがとう!Apple Mapkitのフライオーバーをアニメーション化する方法は?
import UIKit
import CoreLocation
import MapKit
class Flyover: UIViewController, MKMapViewDelegate {
var coordinate = CLLocationCoordinate2D(latitude: 40.7484405, longitude: -73.9856644)
let distance : CLLocationDistance = 700
let pitch : CGFloat = 65
let heading = 90.0
var camera: MKMapCamera?
@IBOutlet var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
mapView.mapType = .SatelliteFlyover
let camera = MKMapCamera(lookingAtCenterCoordinate: coordinate,fromDistance: distance,pitch: pitch,heading: heading)
mapView.camera = camera
//I want the animation to play automatically as soon as the user is in the view.
UIView.animateWithDuration(10.0, animations: {
self.camera!.heading += 180
self.camera!.pitch = 25
self.mapView.camera = self.camera!
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
Niravさんありがとうございましたか?私はあなたがプロのリンゴの開発者であることを見た –
私はこれを試したことはありません私は答えを見つける場合私はそれを検索します私はここで答えを投稿します。 –
ありがとうございます。 WWDCビデオにはソースコードがありますが、それはOS X向けです。 –