I'm working on an app that gives the user the option to take a photo for their profile picture, but can't seem to figure out how to:
- Get the photo to save to the users library
- Get that photo to replace a default photo when they press "use" (that is there when the user first loads the app)
Any suggestions? This code might be completely off but here is what I was starting to use:
- (void)takePhoto {
UIImagePickerController *takePhotoPicker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
takePhotoPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
takePhotoPicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
} else {
takePhotoPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[self presentViewController:takePhotoPicker animated:YES completion:nil];
}