Я пытаюсь поместить изображение в свой пользовательский интерфейс. Controllers
, представленный в качестве UITabBarItem, равен UINavigationControllers
. Когда я пытаюсь поместить на них изображения, результат выглядит не очень хорошо. Я получаю только половину изображений, и изображения не отображают цвет.
3 изображения, которые я использовал, имеют размер .png 50X50.
вот код, который я использовал
self.custCareVC = [[CustomerCareViewController alloc] initWithNibName:@"CustomerCareViewController_iPhone" bundle:NULL];
self.POController = [[PurchaeOrderViewController alloc] initWithNibName:@"PurchaeOrderViewController_iPhone" bundle:NULL];
self.accAndContactsController = [[AccountsAndContactsViewController alloc] initWithNibName:@"AccountsAndContactsViewController_iPhone" bundle:NULL];
self.customerCareNavController = [[UINavigationController alloc] initWithRootViewController:self.custCareVC];
self.customerCareNavController.title = @"Customer Service";
self.purchaseOrderNavController = [[UINavigationController alloc] initWithRootViewController:self.POController];
self.purchaseOrderNavController.title = @"PO";
self.accAndContactsNavController = [[UINavigationController alloc] initWithRootViewController:self.accAndContactsController];
self.accAndContactsNavController.title = @"Accounts And Contacts";
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:self.customerCareNavController, self.accAndContactsNavController, self.purchaseOrderNavController, nil];
UIImage *selectedImage0 = [UIImage imageNamed:@"cust_serv_bw_selected.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"cust_serv_bw.png"];
UIImage *selectedImage1 = [UIImage imageNamed:@"contacts_bw_selected.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"contacts_bw.png"];
UIImage *selectedImage2 = [UIImage imageNamed:@"po_bw_selected.png"];
UIImage *unselectedImage2 = [UIImage imageNamed:@"po_bw.png"];
UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
item0.image = unselectedImage0;
item0.selectedImage = selectedImage0;
item1.image = unselectedImage1;
item1.selectedImage = selectedImage1;
item2.image = unselectedImage2;
item2.selectedImage = selectedImage2;
self.tabBarController.selectedViewController = self.customerCareNavController;
Как я могу исправить это. Почему это происходит?