title: Can not save a part of the screen in iOS
body: <p>I want to take a screenshot of a part of the iphone screen, but I don't know why I'm stuck. I don't know what I am doing wrong,  because i get no errors on th execution. I have see this<a href="https://stackoverflow.com/questions/6132014/how-can-i-save-a-photo-of-part-of-the-screen-to-the-local-iphones-photos"> question</a> here, and follow step by step, but... I do not wheres is the error... so please help guys</p>
  
  <p>here is my code:</p>
  
  <pre><code>-(void)saveImageBig
  {
      UIImage *myBigImage = [self imageFromBig]; // this method returns a UIImage to store inside myBigImage
  
      NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; //the directory
  
      NSString *pngFilePath = [NSString stringWithFormat:@"%@/myPic.png",docDir]; // the full path of the image .PNG
      NSLog(@"%@", pngFilePath); //just to check the address
      NSData *data1 = [NSData dataWithData:UIImagePNGRepresentation(myBigImage)]; //Create an NSData from the PNG
      [data1 writeToFile:pngFilePath atomically:YES]; //Put the data inside the address as a PNG
  }
  
  -(UIImage *)imageFromBig
  {
      CGSize size  = CGSizeMake(568.0, 288.0); //a part of the iphone screen
      UIGraphicsBeginImageContextWithOptions(size,NO,0.0); 
      UIImage *bigImage; //The image pointer
      UIImageView *bigImageView;
  
      [bigImageView.image drawInRect:CGRectMake(16, 20, size.width, size.height)];  //Beginning X16 Y20 take a screenshot of 568X288 (size)
      bigImage = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
      UIImageWriteToSavedPhotosAlbum(bigImage, self,@selector(image:didFinishSavingWithError:contextInfo:), nil);
      return bigImage; //Save the image into albumns
  }
  
  - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
  { //just the alerts... 
      if (error != NULL)
      {
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Image could not be saved.Please try again"  delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Close", nil];
          [alert show]; //Not saved
      } else {
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Image was successfully saved in photoalbum"  delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Close", nil];
          [alert show]; //Saved
      }
  }
  
  - (IBAction)SaveImageBtn:(id)sender
  {
      [self saveImageBig];
  }
  </code></pre>
  
  <p>The result says that the image was successfully saved, but the image es blank, empty but there is objects and cotrols in that area (size = 568X288).</p>
  
  <p>Hope you can help me with this, thanks in advance.</p>