I am new to ios development. I created UITabbar
programatically and set its delegate to self. All functions well. But my tabbar consists three tab bar items. I have given different images to the different tab bar items. But they all shows another image.
This is my code:
UITabbarItem item1 = [[UITabBarItem alloc] initWithTitle:@"item1" image:[UIImage imageNamed:@"imagename"] tag:1];
Try this :
UIImage *selectedImage0 = [UIImage imageNamed:@"tab-selected.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"tab-unselected.png"];
[item1 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.