1

I have created a splitview based application and in the appDelegate applicationdidFinishLaunchingWithOptions method i am showing a popup

(BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    [self.window addSubview:splitViewController.view];
    [self.window makeKeyAndVisible];

    ModalScreenPopup *modalpopup = [[ModalScreenPopup alloc] init];
    [modalpopup setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
    [modalpopup setModalPresentationStyle:UIModalPresentationFullScreen];

    [splitViewController presentModalViewController:modalpopup animated:NO];
    [modalpopup release];

    return YES;
}

(void) OpenTradeShowListingPopup
{
    [splitViewController dismissModalViewControllerAnimated:YES];

    TradeShowListing *modalTradeShowListing = [[TradeShowListing alloc] init];

    [modalTradeShowListing setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
    [modalTradeShowListing setModalPresentationStyle:UIModalPresentationFullScreen];

    [splitViewController presentModalViewController:modalTradeShowListing animated:YES];

    [modalTradeShowListing release];
}

ModalScreenPopup has 2 buttons name Synchronize and continue with app when I click on the synchronize button I am calling OpenTradeShowListingPopup method which is declared in the appDelegate. That method calls another popup but now first modal is getting dismissed but second popup is not getting called.


I have solved my problem by using UINavigationController this post really help me a lot A guy name JNOXX has helped me on Mac Forums here is the link.

Thanks 7KV7 for helping me.

Dori
  • 915
  • 1
  • 12
  • 20
Rahul Jain
  • 612
  • 1
  • 18
  • 49

1 Answers1

2

I think this is the issue

[splitViewController dismissModalViewControllerAnimated:YES];

Try instead

[self dismissModalViewControllerAnimated:YES];
Matteo Alessani
  • 10,264
  • 4
  • 40
  • 57
visakh7
  • 26,380
  • 8
  • 55
  • 69
  • Hey 7kv7 my Modal view is getting dismissed but the new modalview is not getting called :( – Rahul Jain Mar 24 '11 at 08:59
  • can you try to self for presenting and dismissing all modalview controllers – visakh7 Mar 24 '11 at 09:00
  • by using self its shows the warning: 'MyAppDelegate' may not respond to '-presentModalViewController:animated:' and its not working :( – Rahul Jain Mar 24 '11 at 09:02
  • Oh so this method is in the app delegate. Hang on – visakh7 Mar 24 '11 at 09:04
  • pls go through this http://stackoverflow.com/questions/1529632/present-and-dismiss-modal-view-controller. It will give you an idea. – visakh7 Mar 24 '11 at 09:12
  • Can you pls check if it works if u write TradeShowListing *modalTradeShowListing = [[TradeShowListing alloc] init]; [modalTradeShowListing setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; [modalTradeShowListing setModalPresentationStyle:UIModalPresentationFullScreen]; [splitViewController presentModalViewController:modalTradeShowListing animated:YES]; instead of ModalScreenPopup and see if its presented – visakh7 Mar 24 '11 at 09:16
  • Yes at that time its getting presented. – Rahul Jain Mar 24 '11 at 09:26
  • ok can you also check if splitviewcontroller exists when u try to present TradeShowListing – visakh7 Mar 24 '11 at 09:29
  • can u just check this app i have created the replica of my issue in my sample app if i post the link can u have a look at it – Rahul Jain Mar 24 '11 at 09:33
  • how can i check if my splitview exists or not ? – Rahul Jain Mar 24 '11 at 09:36
  • I am sorry I don't have a Mac machine now. :( – visakh7 Mar 24 '11 at 09:36
  • Just put a breakpoint in the method and see print the values of the ones you want to check on the console. – visakh7 Mar 24 '11 at 09:36
  • yaa i have put the test values using NSLog and the values are getting print. but tell me 1 thing if the splitviewcontroller dosent exists and when the code reaches that line then the app will crash right ? if right then splitviewcontroller exists – Rahul Jain Mar 24 '11 at 09:42
  • but the app is not getting crash also..........so can u suggest me a different workaround for the same functionality – Rahul Jain Mar 24 '11 at 09:46
  • Yes let me try to find a solution – visakh7 Mar 24 '11 at 09:54
  • In case u wanna see the code here is the link of my sample application [link]http://www.filefactory.com/file/ca4001f/n/2_Modal.zip[/link] – Rahul Jain Mar 24 '11 at 10:01