I have the following code in my AppDelegate.h file:
@class mainViewController;
@class AboutViewController;
@interface iSearchAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
mainViewController *viewController;
AboutViewController *aboutController;
UINavigationController *nav;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet mainViewController *viewController;
@property (nonatomic, retain) IBOutlet AboutViewController *aboutController;
@property (nonatomic, retain) IBOutlet UINavigationController *nav;
[...IBActions declared here...]
@end
Then, in my .m file:
@implementation iSearchAppDelegate
@synthesize window;
@synthesize viewController, aboutController, settingsData, nav, engines;
(void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:nav.view];
[window addSubview:aboutController.view];
[window addSubview:viewController.view];
[window makeKeyAndVisible];
}
-(IBAction)switchToHome{
[window bringSubviewToFront:viewController.view];
}
-(IBAction)switchToSettings{
[window bringSubviewToFront:nav.view];
}
-(IBAction)switchToAbout{
[window bringSubviewToFront:aboutController.view];
}
- (void)dealloc {
[viewController release];
[aboutController release];
[nav release];
[window release];
[super dealloc];
}
@end
Somehow, when I run the app, the main view presents itself fine... however, when I try to execute the actions to switch views, the app crashes with an EXC_BAD_ACCESS.
Thanks for any help in advance.