次の方法で TestDummy.hmxib (UIViewController) を開いている MasterViewController.hmxib (UIViewController) があります。
TestDummy *controller = [[TestDummy alloc] initWithNibName:@"TestDummy" bundle:nil];
[scrollView addSubview:controller.view];
TestDummy には 2 つのボタン (開く)、(閉じる) と 1 つのラベル (windowDepth) があります。
最初の TestDummy によって開かれている 2 番目のインスタンス TestDummy を作成しようとしています。次に、複数の TestDummy (UIViewController) を深さ N まで開き、閉じるボタンで深さ 0 に戻すことができるようにします。これが私の[開く]ボタン用のものです。
-(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'
メモリ管理の問題に違いないのですが、わかりません。
前もって感謝します。