我的导航视图有一个非常奇怪的行为。我想要的是,从我的主视点来看,用户可以触摸一个按钮,从而使他使用应用程序设置进入视图。

这是负责导航的代码:

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。如您所见,我是否将Options Controller的负载从模式变为导航。可以,我在这里错过了什么吗?

感谢您提前提示。

欢呼,雷内

有帮助吗?

解决方案

如果不需要在接口构建器中将其连接到接口构建器中,则在将其添加为子视图之前将其备份/初始化?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top