tags:

views:

20

answers:

2

I'm having difficulty in switching between xibs :(

first i was using navigationController and it worked well but i want to do it without using navigationController.

I tried presentModalViewController but it crashes my application. :((

Here is the code :

    myViewController *viewController = [myViewController alloc] initWithNibName:nil bundle:nil];
    myViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController: myViewController animated:YES];
    [myViewController release];

It is not working, ERROR received : GDB:Program received signal : "EXC_BAD_ACCESS"

A: 

You have set your nibName to nil Enter the name of your Xib file you want to display there Like

 myViewController *viewController = [[myViewController alloc] initWithNibName:@"nameOfYourXIB" bundle:nil]autorelease];
    myViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentModalViewController: myViewController animated:YES];
Aji
i've tried this before.. error
What kind of error are you getting..?
Aji
GDB:Program received signal : "EXC_BAD_ACCESS"
look at your stack.on which line its crashing..?
Aji
A: 

remove the release statement from ur code and everything will work fine.

Actually u r releasing the viewcontroller before it is shown as the superview.

//[myViewController release];

Hope this helps u...

Atulkumar V. Jain
its not working... :(still the same error.
myViewController *viewController = [myViewController alloc] initWithNibName:nil bundle:nil]; viewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentModalViewController: viewController animated:YES]; write the above codepass the instance object instead of the viewcontroller itself
Atulkumar V. Jain