I've been usin开发者_StackOverflow社区g UIGetScreenImage() to get a screenshot of a UIImagePickerController. Basically I use the camera overlay and then when I take the screenshot, I have the image that the camera preview had been showing and my overlay on there too, which is exactly what I need.
Now UIGetScreenImage() has been banned, I've not been able to find a way to do this. It just shows black for the camera.
Edit: all of my other views are showing absolutely fine, just not the actual camera preview. Any ideas??!?!?
Here's the code I am using at the moment.
UIGraphicsBeginImageContext(picker.view.bounds.size);
[picker.view.layer renderInContext:UIGraphicsGetCurrentContext()];
CGContextDrawImage(context, bounds, camView.CGImage);
UIImage* screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
UIGraphicsEndImageContext();
Any ideas how I can get the overlay + the camera image?
Thanks!
This is slightly different than yours.
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *sShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum (sShot, nil, nil, nil);
Does that work?
If not, you might want to try asking over at iphonedevsdk.com since they specialize in all things iPhone.
Have them take a picture. Then overlay your image on top of it.
Create a UIImage from two other UIImages on the iPhone
精彩评论