IOS7 导航栏item完美设置[UIBarButtonItem appearance]

来源:互联网 发布:仿绿茶软件园源码 编辑:程序博客网 时间:2024/06/05 02:16

设置返回按钮的文字与背景

UIImage *backButtonImage = [[UIImage imageNamed:@"Graphics/Shared/navigation_back_button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];  
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage  forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];  
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, backButtonImage.size.height*2) forBarMetrics:UIBarMetricsDefault]; 


设置导航栏的背景颜色

            [[UINavigationBar appearance] setBarTintColor: 颜色];


设置标题的自定义格式

   [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,[UIFont fontWithName:@"HelveticaNeue-Bold" size:20.0f],UITextAttributeFont, nil]];




持续更新中。。。。。。。


0 0