我有这样的代码,当按下一个按钮,加载一个新的UIView(从故事板)。 goPressed功能按钮按下发射并呼吁selectImage功能。 selectImage打开的UIImagePickerController,让用户选择一张照片。 用户已经选择了照片之后,didFinishPickingMediaWithInfo代表所选择的图像添加到一个UIImageView。
在“goPressed”中,进行后selectImage,应当执行在像Segue公司评论作为// 1。 但没有任何反应。 performSegueWithIdentifier似乎并不奏效。 如果我不叫performSegueWithIdentifier之前调用[自我selectImage],它的工作原理。 下面是代码:
- (IBAction)goPressed:(id)sender {
[self selectImage];
[self performSegueWithIdentifier:@"lastView" sender:currentSender]; //1
}
-(void)selectImage
{
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
// Delegate is self
imagePicker.delegate = (id)self;
// Allow editing of image ?
imagePicker.allowsEditing=NO;
// Show image picker
[self presentModalViewController:imagePicker animated:YES];
}
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
[[picker presentingViewController] dismissModalViewControllerAnimated:YES];
lePreview.image= image;
}
请帮帮忙,为什么performSegueWithIdentifier不工作? 我希望我不想你需要的任何信息。