我想動畫我添加爲MKOverLay的圓。我希望它從屏幕的頂部掉落。如何通過委託方法進行動畫製作?還是在添加覆蓋?任何人都可以將我指向正確的方向嗎?謝謝!動畫viewForOverlay MKCircleView
我有這樣的MapView的委託方法
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
if([overlay isKindOfClass:[MKCircle class]]) {
// Create the view for the radius overlay.
MKCircleView *circleView = [[MKCircleView alloc] initWithOverlay:overlay];
circleView.strokeColor = [UIColor whiteColor];
circleView.fillColor = [[UIColor blueColor] colorWithAlphaComponent:0.2];
return circleView;
}
return nil;
}
我補充覆蓋,像這樣:
MKCircle *circle = [MKCircle circleWithCenterCoordinate:userCoord radius:200];
[mainMapView addOverlay:circle];
我實際上想在此方法上添加我繪製圓形覆蓋圖的方法。我應該將上面的代碼添加到MyCustomCircle類中嗎? MKCircle * circle2 = [MKCircle circleWithCenterCoordinate:userCoord radius:[self convertToMetersFromDegrees:radius]]; MyCustomCircle * myCircleView = [[MyCustomCircle alloc] initWithCircle:circle2]; [mainMapView addOverlay:myCircleView.circle]; – Eric
我會說,如果你正在動畫myCircleView,將這段代碼添加到MyCustomCircle - 它會動畫,當它被添加到父視圖 – nielsbot