आईओएस 7, MKOverlayView
में MKOverlayRenderer
द्वारा प्रतिस्थापित किया गया था। इससे पहले, मैं MKOverlayView
पर एक सबव्यूव के रूप में UIImageView
जोड़ने में सक्षम था, और MKOverlayView
के CALayer
तक पहुंच सकता था। अब, UIView
MKOverlayRenderer
में चला गया, मुझे यकीन नहीं है कि कस्टम CALayer
(मेरे पास CAKeyFrameAnimation
है जो चित्रों की एक श्रृंखला के माध्यम से तेज़ी से जाता है) को कैसे जोड़ना है। मैं को MKOverlayRenderer
में कैसे जोड़ूं? मैं को CGContextRef
में कैसे जोड़ूं (MKOverlayRenderer
द्वारा उपयोग किया गया)?MKOverlayRenderer को एक कैलियर जोड़ना?
मैंने इसे अपने आप करने की कोशिश की, लेकिन यह छवियों के माध्यम से नहीं जाता है।
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {
CGContextSaveGState(context);
CGRect test = [self rectForMapRect:self.overlay.boundingMapRect];
// Clip the drawing space to the map rect
CGRect clipRect = [self rectForMapRect:mapRect];
CGContextClipToRect(context, clipRect);
// CoreGraphics' coordinate system is flipped, so we need to transform it first
CGContextScaleCTM(context, 1.0, -1.0);
CGContextTranslateCTM(context, 0, -test.size.height);
// Draw the portion of the image in the map rect
// CGContextDrawImage(context, test, [image CGImage]);
CGContextRestoreGState(context);
CALayer *sublayer = [CALayer layer];
sublayer.frame = test;
NSArray *radarImages = [NSArray arrayWithObjects:(id)image.CGImage, image1.CGImage, image2.CGImage, image3.CGImage, image4.CGImage, image5.CGImage, image6.CGImage, image7.CGImage, image8.CGImage, image9.CGImage, image10.CGImage, image11.CGImage, image12.CGImage, image13.CGImage, image14.CGImage, image15.CGImage, image16.CGImage, image17.CGImage, image18.CGImage,image19.CGImage,image20.CGImage,image21.CGImage, image22.CGImage, image23.CGImage, image24.CGImage, nil];
anim = [CAKeyframeAnimation animation];
[anim setKeyPath:@"contents"];
[anim setCalculationMode:kCAAnimationDiscrete];
[anim setValues:radarImages];
[anim setRepeatCount:INFINITY];
[anim setDuration:2.6];
[self drawLayer:sublayer inContext:context];
[sublayer addAnimation:anim forKey:nil];
[sublayer renderInContext:context];
[sublayer setNeedsDisplay];
}
किसी भी मदद की सराहना की है, धन्यवाद!
मुझे एक ही समस्या है, http://stackoverflow.com/questions/20558591/animated-gif-not-working-in-mkmapview-overlay-using-mkoverlayrenderer?noredirect=1#comment30789828_20558591। उम्मीद है कि स्टैक ओवरफ्लो पर कोई हमारी मदद करेगा। यदि आप इसे समझते हैं तो कृपया मुझे बताएं। – wigging
शायद कॉल करने का प्रयास करें -setNeedsDisplayInMapRect: ज़ूमस्केले: इसे गंदे चिह्नित करने के लिए टाइमर पर, इसलिए आपके drawMapRect को फिर से कॉल किया जाता है। – MindJuice
कोई अपडेट यहाँ? –