I’m really stuck and need some help!
I’m trying to do what we did on the iPad on the iPhone. I have managed to get the ModalView showing on the iPhone by doing:
// Create a new ImageViewController and set its image ImageViewController *ivc = [[ImageViewController alloc] initWithNibName:@"ImageViewController" bundle:nil]; [ivc setImage:img]; [self presentModalViewController:ivc animated:YES];
// Note that this is basically following the already provided code.
I have read the Apple documentation and searched the Internet. From the Apple documentation we have:
“The parent view controller is responsible for dismissing the modal view controller it presented using the presentModalViewController:animated: method. If you call this method on the modal view controller itself, however, the modal view controller automatically forwards the message to its parent view controller. … etc …”
So the recommendations are from Apple and many others to dismiss the ModalViewController (being aware of child/parent/child relationship between the two view controller objects) using:
[self dismissModalViewControllerAnimated:YES]; [[self parentViewController] dismissModalViewControllerAnimated:YES]; // Still not sure on this one.
Unlike the iPad which seems to have a method to remove the popoverController, I can’t find anything to help write the header for the method to remove the ModalViewController for the iPhone.
I’ve tried ImageViewController and UIViewController in a method but I can’t get anything to work.
I was also thinking that, do you put a button on the ImageViewController to dismiss the ModalView but when I did this I couldn’t get the controls over to the ItemsViewController.
Can someone point me in the right direction so I can finish this. Its starting to bother me that I can’t solve it myself. I want to do this as I think it should be part of the book exercises.
Thanks in advance