Save view o the Photos album

Discussion in 'iPhone/iPad Programming' started by iphonejudy, Apr 28, 2009.

  1. macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #1
    // 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:mad:"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?
     
  2. thread starter macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #2
    Sorry.I did a small mistake.I solved it
     
  3. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Gracious, to the end... ;)
     

Share This Page