This happens when coz viewDidAppear is called every time before the view, so as soon as it appears, you drop it and it disappears.
I donβt think that what you are trying to do can be achieved using modalViewControllers ... instead use navigationController and keep adding your view controllers to the stack, and when you want to go to the First view controller, just call
[self.navigationController popToRootViewControllerAnimated:YES]
EDIT
:
just thought about it, this can be achieved through delegation. You make the second delegate to the third, and as soon as you reject the third control, send a message to the delegate. In this message, call [self dismissModalViewControllerAnimated:NO];
.. and you are done .. (quite easy if you know the delegation.)
source share