performSegueWithIdentifier não está funcionando
Eu tenho esse código que carrega um novo UIView (do storyboard) quando um botão é pressionado. A função goPressed é acionada no botão pressionado e chama a função selectImage. selectImage abre um UIImagePickerController e permite ao usuário selecionar uma foto. Depois que o usuário selecionou a foto, o delegado didFinishPickingMediaWithInfo adiciona a imagem selecionada a um UIImageView.
Em 'goPressed', depois que o selectImage é executado, ele deve executar uma Segue como se fosse comentada como // 1. Mas nada acontece. performSegueWithIdentifier não parece estar funcionando. E se eu não chamar [self selectImage] antes de chamar performSegueWithIdentifier, ele funciona. Aqui está o código:
<code>- (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; } </code>
Por favor, ajude, porque performSegueWithIdentifier não está funcionando? Espero não perder nenhuma informação que você precise.