回答編集履歴
1
animateWithDuration
test
CHANGED
@@ -55,3 +55,57 @@
|
|
55
55
|
|
56
56
|
|
57
57
|
とりあえず動きはしたのですが、heading=0(真北)付近での挙動がおかしいです。
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
# animateWithDurationでアニメーション
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
```objectivec
|
66
|
+
|
67
|
+
{
|
68
|
+
|
69
|
+
MKMapCamera *camera;
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
//カメラ初期化
|
76
|
+
|
77
|
+
camera = [MKMapCamera cameraLookingAtCenterCoordinate:m_targetLocation
|
78
|
+
|
79
|
+
fromEyeCoordinate:m_cameraLocation
|
80
|
+
|
81
|
+
eyeAltitude:1000.0];
|
82
|
+
|
83
|
+
camera.heading = 0;
|
84
|
+
|
85
|
+
[self.mapView setCamera:camera];
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
[UIView animateWithDuration:5.0
|
90
|
+
|
91
|
+
delay:0.0
|
92
|
+
|
93
|
+
options:UIViewAnimationOptionCurveLinear
|
94
|
+
|
95
|
+
animations:^{
|
96
|
+
|
97
|
+
//直接変更するのではなく、変更したカメラをセットするのがポイント
|
98
|
+
|
99
|
+
camera.heading = 180; //目標値
|
100
|
+
|
101
|
+
self.mapView.camera = camera;
|
102
|
+
|
103
|
+
} completion:^(BOOL finished) {
|
104
|
+
|
105
|
+
NSLog(@"completed");
|
106
|
+
|
107
|
+
}];
|
108
|
+
|
109
|
+
```
|
110
|
+
|
111
|
+
|