You create new PhotoViewController in imagePickerController:didFinishPickingMediaWithInfo: but you don't push/present it in view hierarchy so it will be dismissed. The best way is pass image as a parameter in performSegueWithIdentifier:sender method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
_tmp = chosenImage;
[picker dismissViewControllerAnimated:YES completion:NULL];
[self performSegueWithIdentifier:@"viewPhoto" sender: chosenImage];
}
and in prepareForSegue:segue: method get image from sender and pass it to destination view controller:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// TODO: check segue identifier
PhotoViewController *vc = (PhotoViewController*)segue.destinationViewController;
// Get the image
UIImage *img = (UIImage*)sender
// Pass image to the new view controller.
vc.imageView.image = img;
//It can failed because your image view can not be created
// You should use @property for UIImage, pass img to image and in view did load
//assign imageView.image = image
}