初始化navgationBar的简单设置


初始化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的简单设置)