I use the following code to get a screenshot of the screen and save it to the photo albums.
CGImageRef screen = UIGetScreenImage();
UIImage *screenImage = [UIImage imageWithCGImage:screen];
UIImageWriteToSavedPhotosAlbum(screenimage, nil, nil), nil);
This works great but if my app is in landscape mode the saved image does not come out right. (in needs a 90 degree turn). What do i need to do?
Test for either
Then do the appropriate transformations to the image.
This can be done in several ways, this one doesn’t take a lot of code:
I modified it a little before posting to make it self-contained, but it should work with a little effort (e.g. create
self.imageetc). You may just blend them into one function.