我创建了一个包含许多的tabbarcontrollerUINavigationcontroller
,但它不能在每个tabbaritem中显示图像。
你可以看到这张图片:
我使用此代码创建uitabbarcontroller
:
// FirstViewController
UploadTab *uploadview=[[UploadTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *uploadTabItem = [[[UINavigationController alloc] initWithRootViewController: uploadview] autorelease];
uploadview.title=@"Uploading";
uploadview.tabBarItem.image=[UIImage imageNamed:@"Uploading.png"];
//SecondViewController
ConvertTab *convertView=[[ConvertTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *convertTabItem = [[[UINavigationController alloc] initWithRootViewController: convertView] autorelease];
convertView.title=@"Convert";
convertView.tabBarItem.image=[UIImage imageNamed:@"Convert.png"];
//ThirdViewController
CompletedTab *completedView=[[CompletedTab alloc]initWithNibName:nil bundle:nil];
UINavigationController *completedTabItem = [[[UINavigationController alloc] initWithRootViewController: completedView] autorelease];
completedView.title=@"Completed";
completedView.tabBarItem.image=[UIImage imageNamed:@"Completed.png"];
NSArray *viewControllersArray =[NSArray arrayWithObjects:uploadTabItem,convertTabItem, completedTabItem, nil];
self.tab.viewControllers=viewControllersArray;
[self presentModalViewController:self.tab animated:NO];
谢谢你的帮助。