设置UITabBarItem使用自己设计的图片,其中UITabBarItem中有一个方法
第一个参数是选中的时候的图片,第二个参数是未选中的时候的图片。
说明该方法是支持UIAppearance协议的。这个方法怎么用呢。
- - (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage
第一个参数是选中的时候的图片,第二个参数是未选中的时候的图片。
另外,UITabBarItem自带的文字未选中时是白色的,我们想要修改这个字体颜色,怎么办呢?
UITabBarItem的父类UIBarItem提供了这样一个方法
- - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
下面举个例子
- [tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
- [UIColor whiteColor], UITextAttributeTextColor,
- nil] forState:UIControlStateNormal];