我有一个名为CKCalendarViewControllerInternal
.
CKCalendarViewControllerInternal
这个类是 的子类UIViewController
。
CkCalendarViewController
我有一个名为CKCalendarViewController的自定义视图控制器。它是UINavigationController
如下的子类:
@interface CKCalendarViewController : UINavigationController <CKCalendarViewDelegate, UINavigationControllerDelegate>
此类初始化CKCalendarViewControllerInternal
如下:
- (id)init
{
CKCalendarViewControllerInternal *calendarViewController = [CKCalendarViewControllerInternal new];
self = [super initWithRootViewController:calendarViewController];
}
现在,AppDelegate
我的第一个观点如下:
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
UINavigationController *n1=[[UINavigationController alloc]init];
n1.viewControllers=[[NSArray alloc]initWithObjects:self.viewController, nil];
self.window.rootViewController=n1;
[self.window makeKeyAndVisible];
return YES;
}
CkDemoViewController
这个类是如下的子CkCalendarViewController
类
@interface CKDemoViewController : CKCalendarViewController
视图控制器.m
当我尝试按下CKDemoViewController
打开按钮时。
错误和问题 它向我显示错误,例如
Exception: Pushing a navigation controller is not supported
Exception: [NSException]:Pushing a navigation controller is not supported
ex.name:'NSInvalidArgumentException'
ex.reason:'Pushing a navigation controller is not supported'
错误原因
这是因为CKCalendarViewController
是 的子类UINavigationController
。如果我尝试打开模态视图,它会完美运行。
但是我怎样才能CKCalendarViewController
用类初始化如上所示CKCalendarViewControllerInternal
?
谢谢,
答案将不胜感激