Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是ios开发新手。我UITabbar以编程方式创建并将其委托设置为 self. 所有功能都很好。但我的标签栏包含三个标签栏项目。我为不同的标签栏项目提供了不同的图像。但它们都显示了另一个图像。
UITabbar
这是我的代码:
UITabbarItem item1 = [[UITabBarItem alloc] initWithTitle:@"item1" image:[UIImage imageNamed:@"imagename"] tag:1];
尝试这个 :
UIImage *selectedImage0 = [UIImage imageNamed:@"tab-selected.png"]; UIImage *unselectedImage0 = [UIImage imageNamed:@"tab-unselected.png"]; [item1 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];