Wednesday, March 13, 2013

Taking High resolution screenshot for ratina display ... iOS


CGRect screenRect = CGRectMake(0.0f, 44.0f,320.0f, 424.0f);


//High Resolution ScreenShot (640*848)
 UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque,  [[UIScreen mainScreen] scale]);
     [view.layer renderInContext:UIGraphicsGetCurrentContext()];
     
     UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
     
     UIGraphicsEndImageContext();


//Low Resolution ScreenShot (320*424)


UIGraphicsBeginImageContext(screenRect.size);

CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
    [self.view.layer renderInContext:ctx];
screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

No comments:

Post a Comment