【发布时间】:2011-04-15 15:16:41
【问题描述】:
我的导航视图有一个非常奇怪的行为。我想要的是,从我的主视图中,用户可以触摸一个按钮,这会将他引导到具有应用程序设置的视图。
这里是代码,负责导航:
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]; 返回是; }viewController.h
#进口 #import "optionsViewController.h" // 'settings' 视图控制器 @class AppDelegate; @接口视图控制器: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 Animation:YES]; [选项控制器发布]; }我的 optionsController 是一个“普通”的 UIViewController。如您所见,我是否将 optionsController 的负载从模式更改为导航。会不会是我遗漏了什么?
提前感谢您的任何提示。
干杯,勒内
【问题讨论】:
标签: iphone objective-c uinavigationcontroller pushviewcontroller