title: Adding zoom in/out and crop for photo
body: <p>I am trying to add capability to zoom in/out and crop a profile image before saving change but I am not sure how to go about this. Here below are my relevant codes:</p>
  
  <pre><code>- (void)viewDidLoad {
  
      ...
  
      NSString *urlString = [User sharedUser].avatar;
      NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
      [_avatarImageView setImageWithURLRequest:imageRequest placeholderImage:nil success:^(NSURLRequest *request,   NSHTTPURLResponse *response, UIImage *image) {
          _avatarImageView.image = image;
      } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
          NSLog(@"Error: %@", error);
      }];
      _avatarImageView.layer.masksToBounds = YES;
      _avatarImageView.layer.cornerRadius = _avatarImageView.frame.size.width / 2; //create circle image
  
      [self initImagePicker];
  
      ...
  
  }
  
  - (void) initImagePicker {
      myPicker = [[MyImagePicker alloc] init];
      myPicker.SourceVC = self;
      myPicker.SourceView = self.view;
      myPicker.delegate = self;
      myPicker.isImage = YES;
  
      [myPicker initImagePicker];
  }
  
  - (IBAction) ChooseImageSourceAlbum {
  
      tempType = POPUP_TYPE_IMAGPICKER;
      selectArray = @[@"Camera",@"Choose Photos",@"Delete Photo"];
  
      //Call popup
      PopupTemplateViewController *vc = [[PopupTemplateViewController alloc] initWithNibName:@"PopupTemplateViewController" bundle:nil];
      vc.delegate = self;
      vc.dataArray = selectArray;
      vc.type = POPUP_TYPE_OTHERS;
      self.useBlurForPopup = NO;
  
      [self presentPopupViewController:vc animated:YES completion:nil];
  }
  
  - (void) MyImagePickerTakePicture:(NSDictionary *)_dic {
  
      NSString *mediaType = [_dic objectForKey:UIImagePickerControllerMediaType];
      if ([mediaType isEqualToString:@"public.image"]) {
          UIImage *image = [_dic objectForKey:UIImagePickerControllerOriginalImage];
  
          //??? add crop and zoom image here!!!
  
         [self performSelector:@selector(processImage:) withObject:image afterDelay:0.25f];
  
      }
  }
  
  - ( void )processImage:( UIImage * )image {
  
      CGFloat ratio = 1.0;
      if (image.size.width &gt; 400) {
          ratio = 400 / image.size.width;
      }
      else if (image.size.height &gt; 600) {
          ratio = 600 / image.size.height;
      }
  
      UIImage *imageResize = [self scaleImage:image toScale:ratio];
      [_avatarImageView setImage:imageResize];
  
      [self UpdateAvatar];
  
  }
  
  - (UIImage *)scaleImage:(UIImage *)image toScale:(float)scaleSize{
      UIGraphicsBeginImageContext(CGSizeMake(image.size.width * scaleSize, image.size.height * scaleSize));
      [image drawInRect:CGRectMake(0, 0, image.size.width * scaleSize, image.size.height * scaleSize)];
      UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
      UIGraphicsEndImageContext();
  
      return scaledImage;
  }
  
  - (void) UpdateAvatar {
      [self showSeachingPopViewinView:self.view type:POPUP_TYPE_UPDATE];
  
      NSString *account = [[User sharedUser] account];
  
      NSMutableDictionary *parameters = [NSMutableDictionary new];
      [parameters setObject:account forKey:@"account"];
      [parameters setObject:_avatarImageView.image forKey:@"avatar"];
  
      [GatewayManager callUpdateAvatar:parameters delegate:self];
  }
  
  - (void)popupView:(PopupTemplateViewController *)popupView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
      [self dismissPopupViewControllerAnimated:NO completion:nil];
      NSString *str = selectArray[indexPath.row];
      if ([str isEqualToString:@"Camera"]) {
          [myPicker OpenCamera];
      }
      else if ([str isEqualToString:@"Choose Photos"]) {
          [myPicker OpenAlbum];
      } else {
          [self deletePhoto];
      }
  }
  </code></pre>
  
  <p>Now when I tab the profile image it will pop up view showing 3 choices: Camera, Choose Photo, Delete Photo. What I want to achieve is that after taking a photo or choosing a photo I want to have another view with the photo that I can zoom in/out and crop. Thanks in advance.</p>