title: UIImagePickerController - crop picture to circle
body: <p>Ho do I crop circle images with Image picker controller?</p>
  
  <p>The pictures I'm displaying in my projects are round using the code below</p>
  
  <pre><code> CALayer *image = profileImageView.layer;
          [image  setCornerRadius:50];
          [image  setMasksToBounds:YES];
  
          [image setBorderColor:[[UIColor whiteColor]CGColor]];
          [image setBorderWidth:5];
  </code></pre>
  
  <p>So far I have this code to crop images but it only makes them square </p>
  
  <pre><code>   - (void)showPhotoLibary
      {
          if (([UIImagePickerController isSourceTypeAvailable:
                UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)) {
              return;
          }
  
          UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
          mediaUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
  
          // Displays saved pictures from the Camera Roll album.
          mediaUI.mediaTypes = @[(NSString*)kUTTypeImage];
  
          // Hides the controls for moving &amp; scaling pictures
          mediaUI.allowsEditing = YES;
  
  
          mediaUI.delegate = self;
  
  
          [self presentViewController:mediaUI animated:YES completion:nil];
      }
  
  
      - (void) imagePickerController: (
                                       UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info {
  
          UIImage *originalImage = (UIImage *) [info objectForKey:UIImagePickerControllerOriginalImage];
          self.profileImageView.image = originalImage;
  
  
  
          [picker dismissViewControllerAnimated:YES completion:nil];
  
      }
  </code></pre>