我在 xcode 4.2 中创建了新的选项卡栏项目,并且没有应用程序委托 xib 文件。项目有两个导航控制器。我可以设置标签栏的名称,但无法设置图像。我完全受够了许多尝试。FirstViewController *firstView = [[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil]
firstView.title=@"Birthdays";
firstView.tabBarItem.image=[UIImage imageNamed:@"bottomleft.png"];
SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil];
secondView.title=@"Settings";
secondView.tabBarItem.image=[UIImage imageNamed:@"bottomright.png"];
UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController:secondView];
navController2.navigationBarHidden=YES;
[viewControllers addObject:navController2];
在这里你可以看到我得到了什么样的输出。