PDA

View Full Version : Save view o the Photos album




iphonejudy
Apr 29, 2009, 01:55 AM
// Create an image for the view and save it to the Photos library
- (void)savePhotoOfView:(UIView *)view
{
UIGraphicsBeginImageContext(view.bounds.size);
[view drawRect:view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(image,
self,
@selector(savedPhotoImage:didFinishSavingWithError:contextInfo:),
NULL);
}

// Called by UIImageWriteToSavedPhotosAlbum() when it completes
- (void) savedPhotoImage:(UIImage *)image
didFinishSavingWithError:(NSError *)error
contextInfo:(void *)contextInfo
{
NSString *message = @"This image has been saved to your Photos album";
if (error) {
message = [error localizedDescription];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}


The above code is storing a blank viewin the photo album.Can anyone tell what is the wrong in the code?



iphonejudy
Apr 29, 2009, 02:11 AM
Sorry.I did a small mistake.I solved it

dejo
Apr 29, 2009, 09:28 AM
Sorry.I did a small mistake.I solved it
Gracious, to the end... ;)