初始化navgationBar的简单设置

2016-07-09  本文已影响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"];

}
上一篇 下一篇

猜你喜欢

热点阅读