Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering MKMapView to UIImage with real resolution

Tags:

I am using this function for rendering MKMapView instance into image:

@implementation UIView (Ext)
- (UIImage*) renderToImage
{
  UIGraphicsBeginImageContext(self.frame.size);
  [self.layer renderInContext:UIGraphicsGetCurrentContext()];
  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext(); 
  return image;
}

This works fine. But with iphone4 the rendered image doesn't have same resolution as it has really on device. On device I have the 640x920 map view quality, and rendered image has the resolution 320x460. Then I doubled the size that is provided to UIGraphicsBeginImageContext() function but that filled the only top-left image part.

Question: Is there any way to get map rendered to image with full resolution 640x920?