title: Turn FBProfilePictureView into UIImage
body: <p>I have a Facebook login that gets the users <strong>profilePicture, lblUsername, and lblEmail</strong>. I know that the FBProfilePictureView is a UIView that contains a UIImageView. </p>
  
  <p>So, what I am asking is how do I convert or "save" the <strong>profilePicture</strong> that you get from Facebook as a UIImage? Here is my <strong>LoginViewController.m</strong>. I have imported the Facebook SDK correctly in the <strong>LoginViewController.h</strong> file.</p>
  
  <pre><code>#import "LoginViewController.h"
  #import &lt;QuartzCore/QuartzCore.h&gt;
  
  @interface LoginViewController ()
  
  - (void)toggleHiddenState:(BOOL)shouldHide;
  
  @end
  
  @implementation LoginViewController
  
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      [self toggleHiddenState:YES];
      self.lblLoginStatus.text = @"";
  
      self.loginButton.readPermissions = @[@"public_profile", @"email"];
      self.loginButton.layer.cornerRadius = 0;
      [self.loginButton.layer setBorderWidth:0.0f];
  
      self.loginButton.delegate = self;
  
  
  //    UIImageView *image = nil;
  //    
  //    for (NSObject *pic in [self.profilePicture subviews]) {
  //        if ([pic isMemberOfClass:[UIImageView class]]) {
  //            UIImageView *objImg = (UIImageView *)pic;
  //            image = objImg.image;
  //            break;
  //        }
  //    }
  //    
  //    self.view.backgroundColor = [UIColor colorWithPatternImage:image];
  //
      // Do any additional setup after loading the view.
  }
  
  -(void)toggleHiddenState:(BOOL)shouldHide{
      self.lblUsername.hidden = shouldHide;
      self.lblEmail.hidden = shouldHide;
      self.profilePicture.hidden = shouldHide;
      self.loggedinwallpaper.hidden = shouldHide;
      self.FBlogout.hidden = shouldHide;
  }
  
  -(void)toggleUnhiddenState:(BOOL)shouldShow{
      self.loggedinwallpaper.hidden = NO;
  }
  
  -(void)loginViewShowingLoggedInUser:(FBLoginView *)loginView{
      self.lblLoginStatus.text = @"";
  
      [self toggleHiddenState:NO];
      [self toggleUnhiddenState:YES];
  }
  
  -(void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView{
      self.lblLoginStatus.text = @"";
  
      [self toggleHiddenState:YES];
  }
  
  -(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id&lt;FBGraphUser&gt;)user{
      NSLog(@"%@", user);
      self.profilePicture.profileID = user.objectID;
      self.lblUsername.text = user.name;
      self.lblEmail.text = [user objectForKey:@"email"];
      UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
      UIViewController *homeViewController = (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"];
      [self presentViewController:homeViewController animated:YES completion:nil];
  
  //    
  //    for (NSObject *obj in [self.profilePicture subviews]) {
  //        if ([obj isMemberOfClass:[UIImageView class]]) {
  //            UIImageView *objImg = (UIImageView *)obj;
  //            image = objImg.image;
  //            break;
  //        }
  //    }
  }
  
  
  
  -(void)loginView:(FBLoginView *)loginView handleError:(NSError *)error{
      NSLog(@"%@", [error localizedDescription]);
  }
  
  - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  
  #pragma mark - Navigation
  
  // In a storyboard-based application, you will often want to do a little preparation before navigation
  //- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  //    UIImage *image = _profilePicture;
  //    HomeViewController *homeviewController = (HomeViewController *)segue.destinationViewController;
  //    homeviewController.homepic = image;
  //
  
      // Get the new view controller using [segue destinationViewController].
      // Pass the selected object to the new view controller.
  //}
  
  
  @end
  </code></pre>