UITabBarItem修改背景
2013-06-13 12:00
274 查看
设置UITabBarItem使用自己设计的图片,其中UITabBarItem中有一个方法
[plain]
view plaincopy
- (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage
第一个参数是选中的时候的图片,第二个参数是未选中的时候的图片。
另外,UITabBarItem自带的文字未选中时是白色的,我们想要修改这个字体颜色,怎么办呢?
UITabBarItem的父类UIBarItem提供了这样一个方法
[plain]
view plaincopy
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
说明该方法是支持UIAppearance协议的。这个方法怎么用呢。
下面举个例子
[plain]
view plaincopy
[tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
nil] forState:UIControlStateNormal];
[plain]
view plaincopy
- (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage
第一个参数是选中的时候的图片,第二个参数是未选中的时候的图片。
另外,UITabBarItem自带的文字未选中时是白色的,我们想要修改这个字体颜色,怎么办呢?
UITabBarItem的父类UIBarItem提供了这样一个方法
[plain]
view plaincopy
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
说明该方法是支持UIAppearance协议的。这个方法怎么用呢。
下面举个例子
[plain]
view plaincopy
[tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
nil] forState:UIControlStateNormal];
相关文章推荐
- IOS 7修改UITabbar背景图片、UITabBarItem图片以及UITabBarItem的文字颜色.
- UITabBarController修改背景
- iOS开发- UITabBarController的TabBar、TabBarItem背景颜色设置
- UINAV,UITOOLBAR,UISEARCHBAR,UITABBAR修改背景图片(转载)
- ios开发之修改UITabBarItem的默认字体大小、颜色
- UITabBar实现自定义背景及UITabBarItem自定义图片和字体
- UITabbar 中的 item的字体颜色 item点击后的tint颜色 和图片颜色的修改 UINavigationBar字体设置
- UITabBarController 修改背景
- IOS UITabBarViewController 修改背景颜色
- 修改UITabBarItem的字体颜色
- IOS7下的UITabBarItem 的背景图片的设置
- Android--GridView/ListView 点击Item修改Item背景 标识是当前选择项方法
- 修改UITabBarItem字体颜色
- iOS开发之Swift标签栏按钮UITabBarItem样式修改(图标文字尺寸,颜色等)
- 关于在Android中如何点击GridView或者ListView中item子项达到修改子项背景的问题解决方案
- iOS开中设置UITabBar的背景图片以及各个item的选中图片和未选中
- swift UITabBarItem修改字体颜色和图标颜色
- IOS UITabBar+UINavigation(改变背景/标题文字颜色、状态图片、tabbar选中方形背景、item间距)
- Tabbar 的 tabBarItem 图片背景颜色修改
- ios:UITabBarController 修改背景图,修改选中时背景色