我有一个功能,我想有两个UIImageViews和两个UIImagePickers。我如何将它们分开。这是我到目前为止所做的:
·H
UIImagePickerController *personPicker;
UIImagePickerController *backgroundPicker;
的.m
-(IBAction)actionName {
backgroundPicker = [[UIImagePickerController alloc] init];
backgroundPicker.delegate = self;
backgroundPicker.sourceType=UIImagePickerControllerSourceTypeCamera;
backgroundPicker.allowsEditing=YES;
[self presentModalViewController:backgroundPicker animated:YES];
}
-(IBAction)actionName {
personPicker = [[UIImagePickerController alloc] init];
personPicker.delegate = self;
personPicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
personPicker.allowsEditing=YES;
[self presentModalViewController:personPicker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo {
if (personPicker) {
personPic.image = image;
}
if (backgroundPicker) {
Backgrounds.hidden=YES;
backing.image = image;
backgroundPic.image = image;
}
[personPicker dismissModalViewControllerAnimated:YES];
[backgroundPicker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[personPicker dismissModalViewControllerAnimated:YES];
[backgroundPicker dismissModalViewControllerAnimated:YES];
if (personPicker) {
personPic.image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
}
if (backgroundPicker) {
Backgrounds.hidden=YES;
backing.image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
backgroundPic.image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
}
}
提到我已经查看了其他堆栈流问题,但他们没有让我受益。