Я понял это благодаря этому посту . Он не использовал собственное разрешение iPhone, хотя 0.0f как последний параметр UIGraphicsBeginImageContextWithOptions должен сделать это. В любом случае, вот обновленный код:
- (void)mapSnapShotWithMapView:(MKMapView *)_mapView {
CGSize s = _mapView.bounds.size;
CGFloat scale = 1.0;
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
scale = [[UIScreen mainScreen] scale];
s = CGSizeApplyAffineTransform(s, CGAffineTransformMakeScale(scale, scale));
}
UIGraphicsBeginImageContextWithOptions(s, NO, 1.0f);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextScaleCTM(ctx, scale, scale);
[[_mapView layer] renderInContext:ctx];
UIImage *thumb = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
ctx = CGBitmapContextCreate(nil, s.width, s.height, 8, s.width, colorSpace, kCGImageAlphaNone);
CGContextSetShouldAntialias(ctx, YES);
CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh);
CGContextDrawImage(ctx, CGRectMake(0, 0, s.width, s.height), thumb.CGImage);
CGImageRef bwImage = CGBitmapContextCreateImage(ctx);
CGContextRelease(ctx);
CGColorSpaceRelease(colorSpace);
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, s.width/2, s.height/2)];
[imageView setImage:[UIImage imageWithCGImage:bwImage]];
CGImageRelease(bwImage);
[self.view addSubview:imageView];
[imageView release];
}