码迷,mamicode.com
首页 > 其他好文 > 详细

UITabBarController+UINavigationController+UIToolBar

时间:2016-06-10 22:55:59      阅读:493      评论:0      收藏:0      [点我收藏+]

标签:

一,各种名称和位置

技术分享

//技巧一键换肤
    [[UINavigationBar appearance]setBarTintColor:[UIColor redColor]];//给所有的NavigationBar换颜色
    [[UITabBar appearance]setBarTintColor:[UIColor blueColor]];//给所有的TabBar换颜色

二,UINavigationBar:

1,设置导航条透明度:self.navigationBar.translucent = NO;

2,设置Bar背景颜色:self.navigationBar.barTintColor = [UIColour RedColour];->The tint color to apply to the navigation bar background.修改bar的背景颜色

3,设置navigation items和bar button items颜色:self.navigationBar.tint = [UIColour BlurColour];->The tint color to apply to the navigation items and bar button items.修改navigation items和bar button items;

4,设置返回箭头的自定义图片//imageWithRenderingMode 图片的显示模式,要设置成originnal图片的颜色才会变成自定义的图片颜色,否则默认系统颜色。

UIImage *backImage = [backImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//注意下面两个属性都要设置,只设置一个是无效的。

[UINavigationBar appearance]setBackIndicatorTransitionMaskImage:backimage];

[UINavigationBar appearance]setBackIndicatorImage:backimage];

5,去掉导航栏的文字,钻了空子,设置了文字的PositionAdjustment就可以了:

UIBarButtonItem baritem = [UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class],nil];

UIOffset offset;

offset.horizontal = -500;

[baritem setBackButtonTitlePositionAdjustment:offset forBarMetrics:UIBarMetricsDefault];

6,导航栏文字的设置.

//返回按钮字体设置

[baritem setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} forState:UIControlStateNormal];

//改变导航的title样式

NSDictionary *TitleAttributes = [NSDictonary dictionaryWithObjectsAndKeys:Nav_title_Colour,NSForegroundcolourAttributeName,Nav_Titlefont,NSfontAttributeName,nil];

[[UINavigationBar appearance]setTitleTextAttributes:titleAttributes];

 

UIToolBar:(UITabbar的位置,工具条)

技术分享

 

UITabBarController+UINavigationController+UIToolBar

标签:

原文地址:http://www.cnblogs.com/yangqinglong/p/5574303.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!