According to the Apple docs, the accepted way to dismiss modal views is by letting the parent controller (i.e. , the view controller that created the modal view) do the dismissing. The best way to do this is by setting the parent controller as the delegate of the modal view controller.
The idea here is that the modal controller tells its parent that it's ready to be dismissed, and the parent decides what course of action to take from there.
Up vote 0 down vote favorite share g+ share fb share tw.
I have a main view. From that main view I show a modal view (MV1). MV1 may show another modal View (MV2).
From MV2, I may show another modal view (MV3). All that MV are shown animated. What I want, is to be able to first display (animated) the next modal view (MVx+1) before "killing" the previous one (MVx).
If I dismiss (animated) MVx before showing MVx+1 : MVx+1 does not appear. If I dismiss (non-animated) MVx before showing MVx+1 : MVx-1 is seen. If I show MVx+1 before dismissing (non-animated) MVx : MVx+1 does not appear.
How may I do? Some code sample would help if you have time, but just a detailed explanation would be enough. Iphone ios cocoa-touch uiviewcontroller modalviewcontroller link|improve this question asked Oct 22 '11 at 11:25Oliver4,18331253 89% accept rate.
– Sean Oct 24 '11 at 3:59 @Sean : No, but I don't want MVx+1 having to deal with some previous displayed view. When killing MV3, I want to get back to MV1 (whatever MV1 could be, and whatever views had been displayed beetween MV1 and MV3). – Oliver Oct 24 '11 at 15:02.
According to the Apple docs, the accepted way to dismiss modal views is by letting the parent controller (i.e. , the view controller that created the modal view) do the dismissing. The best way to do this is by setting the parent controller as the delegate of the modal view controller.
The idea here is that the modal controller tells its parent that it's ready to be dismissed, and the parent decides what course of action to take from there. In order to do this, you have to create a delegate protocol for the modal view controller that the parent controller implements. In your case, you can create a protocol at the top of each of your .
H files for your modal views to do this (or a single protocol in a separate file if all of the modal views can use the same method for dismissal). For example: @protocol MYModalViewDelegate -(void)dismiss; @end Next, in each of your modal view controllers, create an instance variable for the delegate: @interface MYModalViewController1 : UIViewController { id delegate; } When you display a modal view from a current view controller, set the current controller as the delegate. MYModalViewController1 * mvc1 = MYModalViewController1 alloc initWithNibName:@"MYModalViewController1" bundle:nil; mvc1.
Delegate = self; self presentModalViewController:mvc1 animated:YES; mvc1 release; When you want to release the current modal controller, have the modal view controller call the appropriate protocol method on its delegate: self. Delegate dismiss; Now, the delegate can handle where to go next. In your case, you can close MV2 automatically when MV3 closes by calling self.
Delegate dismiss in MV3, then implement dismiss in MV2 as: -(void)dismiss { self dismissModalViewControllerAnimated:YES; self. Delegate dismiss; }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.