Skip to main content
Removed tag from title, improved formatting
Source Link
Costique
  • 23.7k
  • 4
  • 78
  • 79

iPhone how How to take a screenshot of a part of an app's window?

I'm trying to save a screenshot of a part of the screen with all views and layers merged. The only way I know how to do this is with the code below.

The code below creates an 80x80 square, but with a top left corner at 0,0.

How can I cut a smaller rectangle out of a full page screenshot? For example I have a 320x480 full window screenshot, but I only need an 80x80 square centered at 160,240?

UIGraphicsBeginImageContext(smallView.frame.size);  [appDelegate.window.layer renderInContext:UIGraphicsGetCurrentContext()];  UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();  UIGraphicsEndImageContext(); 

Thank you!

iPhone how to take a screenshot of a part of an app's window?

I'm trying to save a screenshot of a part of the screen with all views and layers merged. The only way I know how to do this is with the code below.

The code below creates an 80x80 square, but with a top left corner at 0,0.

How can I cut a smaller rectangle out of a full page screenshot? For example I have a 320x480 full window screenshot, but I only need an 80x80 square centered at 160,240?

UIGraphicsBeginImageContext(smallView.frame.size);  [appDelegate.window.layer renderInContext:UIGraphicsGetCurrentContext()];  UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();  UIGraphicsEndImageContext(); 

Thank you!

How to take a screenshot of a part of an app's window?

I'm trying to save a screenshot of a part of the screen with all views and layers merged. The only way I know how to do this is with the code below.

The code below creates an 80x80 square, but with a top left corner at 0,0.

How can I cut a smaller rectangle out of a full page screenshot? For example I have a 320x480 full window screenshot, but I only need an 80x80 square centered at 160,240?

UIGraphicsBeginImageContext(smallView.frame.size); [appDelegate.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); 

Thank you!

Source Link
Alex Stone
  • 47.4k
  • 59
  • 240
  • 422

iPhone how to take a screenshot of a part of an app's window?

I'm trying to save a screenshot of a part of the screen with all views and layers merged. The only way I know how to do this is with the code below.

The code below creates an 80x80 square, but with a top left corner at 0,0.

How can I cut a smaller rectangle out of a full page screenshot? For example I have a 320x480 full window screenshot, but I only need an 80x80 square centered at 160,240?

UIGraphicsBeginImageContext(smallView.frame.size); [appDelegate.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); 

Thank you!