我正在尝试从 UIViewController 以编程方式创建 UITabBar。我目前正在使用这个算法。然而,我遇到了一个问题。谁能告诉我我缺少什么?
-(void)loadView{
UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
contentView.backgroundColor = [UIColor whiteColor];
self.view = contentView;
TabControllerHelper *tabControllerHelper = [[TabControllerHelper alloc]initWithNibName:@"TabControllerHelper" bundle:[NSBundle mainBundle]];
tabControllerHelper.title = @"First";
TabControllerHelper *tabControllerHelper1 = [[TabControllerHelper alloc]initWithNibName:@"TabControllerHelper" bundle:nil];
tabControllerHelper1.title = @"Second";
//dvdInfoController.tabBarItem.image = [UIImage imageNamed:@"dvdicon.png"];
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.view.frame = CGRectMake(0, 0, 320, 460);
// Set each tab to show an appropriate view controller
[tabBarController setViewControllers:[NSArray arrayWithObjects:tabControllerHelper, tabControllerHelper1, nil]];
[self.view addSubview:tabBarController.view];
}
我收到的错误:
2012-12-11 01:34:27.581 SampleUITabView[7134:c07] -[__NSCFType _tabBarItemClicked:]: unrecognized selector sent to instance 0x7574230
2012-12-11 01:34:27.582 SampleUITabView[7134:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType _tabBarItemClicked:]: unrecognized selector sent to instance 0x7574230'
*** First throw call stack: