清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
/** * 设置导航栏主题 */ + (void)setupNavBarTheme { // 取出appearance对象 UINavigationBar *navBar = [UINavigationBar appearance]; // 设置背景 if (!iOS7) { [navBar setBackgroundImage:[UIImage imageWithName:@"navigationbar_background"] forBarMetrics:UIBarMetricsDefault]; [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque; } // 设置标题属性 NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary]; textAttrs[UITextAttributeTextColor] = [UIColor blackColor]; //设置无阴影 textAttrs[UITextAttributeTextShadowOffset] = [NSValue valueWithUIOffset:UIOffsetZero]; textAttrs[UITextAttributeFont] = [UIFont boldSystemFontOfSize:19]; [navBar setTitleTextAttributes:textAttrs]; } /** * 设置导航栏按钮主题 */ + (void)setupBarButtonItemTheme { UIBarButtonItem *item = [UIBarButtonItem appearance]; // 设置背景 if (!iOS7) { [item setBackgroundImage:[UIImage imageWithName:@"navigationbar_button_background"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [item setBackgroundImage:[UIImage imageWithName:@"navigationbar_button_background_pushed"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; [item setBackgroundImage:[UIImage imageWithName:@"navigationbar_button_background_disable"] forState:UIControlStateDisabled barMetrics:UIBarMetricsDefault]; } // 设置文字属性 NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary]; textAttrs[UITextAttributeTextColor] = iOS7 ? [UIColor orangeColor] : [UIColor grayColor]; textAttrs[UITextAttributeTextShadowOffset] = [NSValue valueWithUIOffset:UIOffsetZero]; textAttrs[UITextAttributeFont] = [UIFont systemFontOfSize:iOS7 ? 14 : 12]; [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal]; [item setTitleTextAttributes:textAttrs forState:UIControlStateHighlighted]; NSMutableDictionary *disableAttrs = [NSMutableDictionary dictionary]; disableAttrs[UITextAttributeTextColor] = [UIColor grayColor]; [item setTitleTextAttributes:disableAttrs forState:UIControlStateDisabled]; }