我的导航视图有一个非常奇怪的行为。我想要的是,从我的主视图中,用户可以触摸一个按钮,这会将他引导到具有应用程序设置的视图。
这是负责导航的代码:
AppDelegate.h
@interface AppDelegate : NSObject { UIWindow *窗口; 视图控制器 *视图控制器;// 我的主视图控制器 UINavigationController *navigationController; } @property (nonatomic, 保留) IBOutlet UIWindow *window; @property (nonatomic, 保留) IBOutlet ViewController *viewController; @property (nonatomic, 保留) IBOutlet UINavigationController *navigationController;
AppDelegate.m
@synthesize 视图控制器; @synthesize 窗口; @synthesize 导航控制器; - (BOOL)应用程序:(UIApplication *)应用程序 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [窗口添加子视图:viewController.view]; [窗口 addSubview:navigationController.view]; [窗口 makeKeyAndVisible]; 返回是; }
视图控制器.h
#进口 #import "optionsViewController.h" // 'settings' 视图控制器
@class AppDelegate; @接口视图控制器:UIViewController { AppDelegate *appDelegate;
视图控制器.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 Animation:YES]; [选项控制器发布]; }
我的 optionsController 是一个“普通”的 UIViewController。如您所见,我是否将 optionsController 的负载从模式更改为导航。难道是,我在这里错过了什么?
感谢您提前提供任何提示。
干杯,勒内