views:

34

answers:

1

In order to speed up my app, I've create three different UIViewController in AppDelegate and it has readonly property for the controllers. Those controllers are used for navigation controller.

If I tap a button on the root view, I just show another view using pushViewController method. Let me show you some code for this here.

UIViewController* controller = delegate.anotherViewController;
[delegate.navigationController pushViewController:controller animated:YES];

At first time, this work well, but if I navigate back and tap the button again, I've got a signal 'EXC_BAD_ACCESS' at second line.

What's wrong? And, how can I prepare all of my view controllers at the beginning, not create them when they are needed?

A: 

Most of the time EXC_BAD_ACCESS means that you've released an object and you're trying to reuse it without retaining it. Look if you have released your viewController too early and whether you are (re)using it the right way or not...

Tim van Elsloo