0
votes

I have a very strange behaviour of my navigation view. What I want is, that from my main view, the user can touch a button, which leads him to the view with the application settings.

Here is the code, responsible for the navigation:

AppDelegate.h

    @interface AppDelegate : NSObject  {
    UIWindow *window;
    ViewController *viewController; // My Main View Controller
    UINavigationController *navigationController; } 

    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet ViewController *viewController;
    @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

AppDelegate.m

@synthesize viewController;
@synthesize window;
@synthesize navigationController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    [window addSubview:viewController.view];
    [window addSubview:navigationController.view];
    [window makeKeyAndVisible];
    return YES;
}

viewController.h

#import 
#import "optionsViewController.h" // the 'settings' view controller
@class AppDelegate;

@interface ViewController : UIViewController {
    AppDelegate *appDelegate;

viewController.m

- (IBAction)showOptionsViewController:(UIBarButtonItem *)sender {
//  optionsController.theSubjectID = self.theSubjectID;
//  [self presentModalViewController:self.optionsController animated:YES];


    optionsViewController *optionsController= [[optionsViewController alloc] initWithNibName:@"optionsViewController" bundle:nil];
    optionsController.theSubjectID = self.theSubjectID;
    [self.navigationController pushViewController:optionsController animated:YES];
    [optionsController release];

}

My optionsController is a 'normal' UIViewController. As you see did I change the load of the optionsController from modal to navigation. Could it be, that I missed something here?

Thanks for any hints in advance.

Cheers, René

1

1 Answers

1
votes

Have you connected it up in Interface Builder if not you need to alloc/init it before you add it as a subview?