performSegueWithIdentifier nie działa
Mam ten kod, który ładuje nowy UIView (z serii ujęć) po naciśnięciu przycisku. Funkcja goPressed jest uruchamiana po naciśnięciu przycisku i wywołuje funkcję selectImage. selectImage otwiera kontroler UIImagePickerController i pozwala użytkownikowi wybrać zdjęcie. Po wybraniu zdjęcia delegat didFinishPickingMediaWithInfo dodaje wybrany obraz do UIImageView.
W 'goPressed', po wykonaniu selectImage, powinno być wykonywane Segue w komentarzach jako // 1. Ale nic się nie dzieje. performSegueWithIdentifier nie działa. A jeśli nie wywołam [self selectImage] przed wywołaniem performSegueWithIdentifier, działa. Oto kod:
- (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;
}
Pomóż, dlaczego performSegueWithIdentifier nie działa? Mam nadzieję, że nie brakuje mi żadnych potrzebnych informacji.