我正在创建一个 ipad 应用程序,我需要在 ParentViewController 的视图中显示一个 ChildViewController,下面的代码可以完美运行。
- (void)viewDidLoad
{
FavViewController *aViewController = [[FavViewController alloc] initWithNibName:@"FavViewController" bundle:nil];
[self.mainView addSubview:aViewController.view];
[super viewDidLoad];
}
当这favViewController
加载到self.MainView
父视图中时,childViewController 中的所有控件都显示正常,但是当我单击 UIButton 时,应用程序崩溃了。下面是崩溃的日志。
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMapTable myAction:]: unrecognized selector sent to instance 0x8093170'
*** First throw call stack:
(0x1733012 0x1558e7e 0x17be4bd 0x1722bbc 0x172294e 0x156c705 0x4a02c0 0x4a0258 0x561021 0x56157f 0x560222 0x4cfb1d 0x4cff02 0x4add4a 0x49f698 0x25fddf9 0x25fdad0 0x16a8bf5 0x16a8962 0x16d9bb6 0x16d8f44 0x16d8e1b 0x25fc7e3 0x25fc668 0x49cffc 0x255d 0x2485 0x1)
libc++abi.dylib: terminate called throwing an exception