我有一个MasterViewController.hmxib(UIViewController中)的另一个实例,在下面的方式打开TestDummy.hmxib(UIViewController中):使用的viewController打开相同的viewController
TestDummy *controller = [[TestDummy alloc] initWithNibName:@"TestDummy" bundle:nil];
[scrollView addSubview:controller.view];
我有两个TestDummy中的按钮:(打开),(关闭)和一个标签:(windowDepth)。
我试图创建第一个TestDummy打开的第二个实例TestDummy。然后允许多个TestDummy(UIViewController)打开到N深度并允许关闭按钮将它们带回零深度。这是我的打开按钮。
-(IBAction) btnOpen_Clicked{
TestDummy *newController = [[TestDummy alloc] initWithNibName:@"TestDummy" bundle:nil];
newController.isNotRoot = YES;
newController.windowDepth = self.windowDepth + 1;
//do stuff...
childDummy = newController;
// start the animated transition
[UIView beginAnimations:@"page transition" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
//insert your new subview
[self.view addSubview:newController.view];
// commit the transition animation
[UIView commitAnimations];
[newController release];
}
当我这样做,我得到在调试控制台中的错误。
2010-10-07 00:59:12.549 OrionClient[5821:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType btnOpen_Clicked]: unrecognized selector sent to instance 0x6a339a0'
必须是内存管理问题,但我无法弄清楚。
在此先感谢。