Я пытаюсь добавить изображение png в качестве пользовательской карты, используя MKOverlayView.Я почти на месте - я могу выстроить изображение в нужном месте, и я знаю, что -drawMapRect: метод в подклассе MKOverlayView вызывается периодически;Я просто не могу заставить изображение правильно визуализироваться.Это полностью размыто, почти до неузнаваемости.Я также знаю, что изображение достаточно большое (это 1936 × 2967).Вот мой код для -drawMapRect:
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context{
// Load image from applicaiton bundle
NSString* imageFileName = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"map.jpg"];
CGDataProviderRef provider = CGDataProviderCreateWithFilename([imageFileName UTF8String]);
CGImageRef image = CGImageCreateWithJPEGDataProvider(provider, NULL, true, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);
// save context before screwing with it
CGContextSaveGState(context);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextSetAlpha(context, 1.0);
// get the overlay bounds
MKMapRect theMapRect = [self.overlay boundingMapRect];
CGRect theRect = [self rectForMapRect:theMapRect];
// Draw image
CGContextDrawImage(context, theRect, image);
CGImageRelease(image);
CGContextRestoreGState(context);
Кто-нибудь знает, что происходит?
Спасибо!Матф