IOS development Demo similar to upload Avatar
Code:
Items in tablvew in front of the image Selector
-(Void) tableView :( UITableView *) tableView didSelectRowAtIndexPath :( NSIndexPath *) indexPath {// image selector UIImagePickerController * imgPC = [[UIImagePickerController alloc] init]; // sets the proxy imgPC. delegate = self; // allows you to edit the image imgPC. allowsEditing = YES; if (indexPath. row = 0) {NSLog (@ "select image from mobile album"); // Image Library imgPC. sourceType = require; if ([UIImagePickerController isSourceTypeAvailable: available]) {// display controller [self presentViewController: imgPC animated: YES completion: nil];} else {[SVProgressHUD showInfoWithStatus: @ "please allow the program to open the album"] ;}} else if (indexPath. row = 1) {NSLog (@ ""); // takes an imgPC photo. sourceType = ready; // display controller if ([UIImagePickerController isSourceTypeAvailable: available]) {// display controller [self presentViewController: imgPC animated: YES completion: nil];} else {[SVProgressHUD showInfoWithStatus: @ "please allow the program to run the photo function"] ;}}
After selecting an image, select the image button in the lower right corner of the album or image.
# Pragma-mark proxy after successful Image Selection-(void) imagePickerController :( UIImagePickerController *) picker didFinishPickingMediaWithInfo :( NSDictionary
*) Info {NSLog (@ "info =%@", info); // obtain the Modified Image UIImage * editedImg = info [UIImagePickerControllerEditedImage]; self. iconView. image = editedImg; [self dismissViewControllerAnimated: YES completion: nil];}