美文网首页
初始化navgationBar的简单设置

初始化navgationBar的简单设置

作者: 伊蕊飘零 | 来源:发表于2016-07-09 21:34 被阅读103次

初始化navgationBar的简单设置

+ (void)initialize

{

UINavigationBar*navigationBar = [UINavigationBarappearanceWhenContainedInInstancesOfClasses:@[self]];

[navigationBarsetBackgroundImage:[UIImageimageNamed:@"nav"]forBarMetrics:UIBarMetricsDefault];

NSMutableDictionary *propertyDictionary = [NSMutableDictionary dictionary];

propertyDictionary[NSFontAttributeName] = [UIFontsystemFontOfSize:17];

propertyDictionary[NSForegroundColorAttributeName] = [UIColorblackColor];

[navigationBarsetTitleTextAttributes:propertyDictionary.copy];

UIBarButtonItem*barButtonItem = [UIBarButtonItemappearanceWhenContainedInInstancesOfClasses:@[self]];

propertyDictionary[NSFontAttributeName] = [UIFontsystemFontOfSize:15];

[barButtonItemsetTitleTextAttributes:propertyDictionary.copy forState:UIControlStateNormal];

[barButtonItemsetBackButtonTitlePositionAdjustment:UIOffsetMake(0,

-200)forBarMetrics:UIBarMetricsDefault];

//两个属性必须同时设置才有效,修改返回的 样式

navigationBar.backIndicatorTransitionMaskImage= [UIImageoriginalImageNamed:@"product_button_back_nor.png"];

navigationBar.backIndicatorImage= [UIImageoriginalImageNamed:@"product_button_back_nor.png"];

}

相关文章

网友评论

      本文标题:初始化navgationBar的简单设置

      本文链接:https://www.haomeiwen.com/subject/btfdjttx.html