For IOS app development, how does one load the Image in the Image Library to the view? Let's take a look! Operation steps: 1. Create a SingleView project, start the simulator, click the browser on the simulator, drag and drop the local image, then click the image long press, and click saveImage To Go To The image library. 2. Modify ViewControllerViewController. h:
# Import <UIKit/UIKit. h> @ interface DXWViewController: UIViewController <UIImagePickerControllerDelegate, response> @ property (retain, nonatomic) IBOutlet UIImageView * imageView; @ property (retain, nonatomic) IBOutlet UIButton * Button; @ property (retain, nonatomic) UIImage * image;-(IBAction) click :( id) sender; @ end ViewController. m: [plain] view plaincopyprint? # Import "DXWViewController. h "@ interface DXWViewController () @ end @ implementation DXWViewController-(void) viewDidLoad {[super viewDidLoad];}-(void) viewWillAppear :( BOOL) animated {self. imageView. image = self. image;} // load succeeded-(void) imagePickerController :( UIImagePickerController *) picker didFinishPickingMediaWithInfo :( NSDictionary *) info {self. image = [info objectForKey: Encrypted]; [picker dismissViewControllerAnimated: YES completion: nil];} // cancel-(void) Cancel :( UIImagePickerController *) picker {[picker dismissViewControllerAnimated: YES completion: nil];}-(void) dealloc {[_ imageView release]; [_ image release]; [_ Button release]; [super dealloc];} // open the image library to obtain the image-(IBAction) click :( id) sender {if ([UIImagePickerController isSourceTypeAvailable: available]) {UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker. sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker. delegate = self; picker. allowsEditing = YES; [self presentViewController: picker animated: YES completion: nil] ;}}