iPhone navigationController не отображается - PullRequest
0 голосов
/ 22 сентября 2010

У меня очень странное поведение моего вида навигации. Я хочу, чтобы на моем главном экране пользователь мог нажать кнопку, которая приводит его к просмотру с настройками приложения.

Вот код, отвечающий за навигацию:

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];

}

Мой optionsController - это обычный UIViewController. Как вы видите, я изменил загрузку optionsController с модального на навигацию. Может быть, я что-то здесь упустил?

Спасибо за любые подсказки заранее.

Ура, Рене

1 Ответ

1 голос
/ 22 сентября 2010

Вы подключили его в Интерфейсном Разработчике, если вам не нужно выделять / инициализировать его перед тем, как добавить его в качестве подпредставления?

...