我有问题之间切换视图控制器。NSInternalInconsistencyException错误
我md360AppDelegate.h头看起来像这样
#import <UIKit/UIKit.h>
@class md360ViewController;
@interface md360AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) md360ViewController *viewController;
@property (strong, nonatomic) UINavigationController *navigationController;
@end
和我md360AppDelegate.m实施看起来是这样的。
#import "md360AppDelegate.h"
#import "md360ViewController.h"
@implementation md360AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[md360ViewController alloc] initWithNibName:@"md360ViewController" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.window setRootViewController:self.navigationController];
[self.window makeKeyAndVisible];
return YES;
}
@end
我正在创建一个UINavigationController实例并将其存储在此类的navigationController属性中。
我想在用户点击md360ViewController中的按钮时更改ViewController。
我的md360ViewController.h看起来像这样。
@interface md360ViewController : UIViewController
@property IBOutlet UIButton *homePathwayBtn;
@property IBOutlet UIButton *homeDiseaseBtn;
@property IBOutlet UIButton *homePipelineBtn;
- (IBAction)homeButton:(id)sender;
@end
和我的实现看起来像
#import "md360ViewController.h"
#import "md360AppDelegate.h"
#import "pipeViewDisease.h"
#import <QuartzCore/QuartzCore.h>
- (IBAction)homeButton:(id)sender {
UIViewController *pipeViewDisease = [[UIViewController alloc] initWithNibName:@"pipeViewDiease" bundle:nil];
[self.navigationController pushViewController:pipeViewDisease animated:YES];
}
,当我在UIButton的点击应用程序崩溃与下面的消息。
终止应用程序由于未捕获的异常 'NSInternalInconsistencyException',理由是: '在 包无法加载NIB: '一个NSBundle (加载)' 名为'pipeViewDiease'
可能是什么问题?
哈哈,最好的错字,谢谢:) – 2013-02-28 13:24:09
@IbrahimAzharArmar它发生了。 – trojanfoe 2013-02-28 13:24:39