Prasad G
Prasad G

Reputation: 6718

Capture MKMapView screenshot different in iOS 5 and iOS 6?

I would like to get screenshot of mapview. So i used following code. This code works perfectly in ipad and simulator but not on ipod. The iPad has iOS 6.0 and my xcode is 4.2.1 and the iPod has iOS 5.0.

- (UIImage*) renderToImage
{
    UIGraphicsBeginImageContext(mapView.frame.size);
    [mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext(); 
    return viewImage;
}

The problem is, i have got same image in iPad, iPod ans simulator but not names corresponding manual screen capture and programatic screen capture.The names are very big in iPod, at the same time names are normal in iPad and simulator and also some names are invisible in iPod.That is the my problem.

The following images are:

This image belongs to iPod manual screen capture.

enter image description here

This image belongs to iPod programatic screen capture.

enter image description here

I don't know where the problem is. Please help me anyone.

Upvotes: 0

Views: 1067

Answers (2)

Craig
Craig

Reputation: 8304

You can tell by looking at the app in each situation, it's not your screenshot code that is magically creating different maps, the underlying maps are different.

Upvotes: 0

Prasad G
Prasad G

Reputation: 6718

The problem is UIGraphicsBeginImageContext(mapView.frame.size); here. I have just replaced this to UIGraphicsBeginImageContextWithOptions(mapView.frame.size, NO, 0.0);. Then it is working in iOS 5.0.

Upvotes: 1

Related Questions