相关疑难解决方法(0)

使用真实分辨率将MKMapView渲染为UIImage

我正在使用此函数将MKMapView实例渲染为图像:

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

这很好用.但是使用iphone4时,渲染图像的分辨率与设备上的分辨率不同.在设备上我具有640x920地图视图质量,渲染图像具有320x460的分辨率.然后我将提供给UIGraphicsBeginImageContext()函数的大小加倍,但填充了唯一的左上角图像部分.

问题:有没有办法将地图渲染为具有全分辨率640x920的图像?

iphone uiimage mapkit

8
推荐指数
1
解决办法
3095
查看次数

标签 统计

iphone ×1

mapkit ×1

uiimage ×1