Use this line:
[self dismissViewControllerAnimated:YES completion:nil];
In place of this line:
[picker dismissViewControllerAnimated:YES completion:nil];
Domanda
I have a problem where I modally present a UIImagePickerController from a UINavigationController and the user presses cancel instead of taking a photo. I dismiss the view from the UIImagePickerControllerDidCancel callback, however when I return to the previous view the entire view (including the navigation bar) is moved up several pixels. The other thing that is extremely odd about it is that when I select a text field on that view, the keyboard is displayed partially offscreen. This only happens on my iPhone (I present it in a popover controller for the iPad and that has no problems).
Here is my code for the didCancel callback:
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
[popoverController dismissPopoverAnimated:YES];
}
else//for iPhone
{
[picker dismissViewControllerAnimated:YES completion:nil];
}
}
Any ideas?
Nessuna soluzione corretta
Altri suggerimenti
Use this line:
[self dismissViewControllerAnimated:YES completion:nil];
In place of this line:
[picker dismissViewControllerAnimated:YES completion:nil];