惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
PCI Perspectives
PCI Perspectives
Webroot Blog
Webroot Blog
罗磊的独立博客
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Last Week in AI
Last Week in AI
美团技术团队
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
The Register - Security
The Register - Security
IT之家
IT之家
WordPress大学
WordPress大学
Jina AI
Jina AI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Help Net Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
NISL@THU
NISL@THU
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
B
Blog
T
Tenable Blog
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
S
Security Affairs
小众软件
小众软件
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
W
WeLiveSecurity
A
Arctic Wolf
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
M
MIT News - Artificial intelligence

博客园 - zhoup

文鹏教育_jmeter培训_逻辑控制器_循环取样器 02 jmeter性能测试系列_JForum测试论坛的环境搭建 01 jmeter性能测试系列_Jmeter的体系结构 NSTimer的使用[zhuang] 实战p12文件转pem文件 UIViewContentMode各类型效果 给iOS开发新手送点福利,简述文本属性Attributes的用法 iOS 在tableView上添加button导致按钮没有点击效果和不能滑动的 zhuang xcode 插件地址 AFNnetworking详解 NSRunLoop详解 利用SQL注入漏洞登录后台的实现方法 Xcode 7免证书真机调试 [转]CABasicAnimation用法 zhuang 定制iOS 7中的导航栏和状态栏 zhuang 自定义Xcode代码模板:Code Snippet [zhang] ViewController的生命周期分析和使用 iOS开发--一些UITabBarItem属性的设置[转] UINavigationItem UINavigationBar 关系分析[转]
IOS 设置导航栏全局样式
zhoup · 2016-01-20 · via 博客园 - zhoup
  1. // 1.设置导航栏背景  
  2. UINavigationBar *bar = [UINavigationBar appearance];  
  3. [bar setBackgroundImage:[UIImage resizeImage:@"NavigationBar_Background.png"] forBarMetrics:UIBarMetricsDefault];  
  4. // 状态栏  
  5. [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;  
  6.   
  7. // 2.设置导航栏文字属性  
  8. NSMutableDictionary *barAttrs = [NSMutableDictionary dictionary];  
  9. [barAttrs setObject:[UIColor darkGrayColor] forKey:UITextAttributeTextColor];  
  10. [barAttrs setObject:[NSValue valueWithUIOffset:UIOffsetMake(0, 0)] forKey:UITextAttributeTextShadowOffset];  
  11. [bar setTitleTextAttributes:barAttrs];  
  12.   
  13. // 3.按钮  
  14. UIBarButtonItem *item = [UIBarButtonItem appearance];  
  15. [item setBackgroundImage:[UIImage resizeImage:@"BarButtonItem_Normal.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];  
  16. [item setBackgroundImage:[UIImage resizeImage:@"BarButtonItem_Pressed.png"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];  
  17.   
  18. NSMutableDictionary *itemAttrs = [NSMutableDictionary dictionaryWithDictionary:barAttrs];  
  19. [itemAttrs setObject:[UIFont boldSystemFontOfSize:13] forKey:UITextAttributeFont];  
  20. [item setTitleTextAttributes:itemAttrs forState:UIControlStateNormal];  
  21. [item setTitleTextAttributes:itemAttrs forState:UIControlStateHighlighted];  
  22. [item setTitleTextAttributes:itemAttrs forState:UIControlStateDisabled];  
  23.   
  24. // 4.返回按钮  
  25. [item setBackButtonBackgroundImage:[UIImage resizeImage:@"BarButtonItem_Back_Normal.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];  
  26. [item setBackButtonBackgroundImage:[UIImage resizeImage:@"BarButtonItem_Back_Pressed.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];  

搞了半天,居然没有发现可以插入Objective-C代码的地方。真郁闷

  1. //  
  2. //  UIImage+Fit.m  
  3. //  SinaWeibo  
  4. //  
  5. //  Created by mj on 13-8-19.  
  6. //  Copyright (c) 2013年 itcast. All rights reserved.  
  7. //  
  8.   
  9. #import "UIImage+Fit.h"  
  10.   
  11. @implementation UIImage (Fit)  
  12.   
  13. #pragma mark 返回拉伸好的图片  
  14. + (UIImage *)resizeImage:(NSString *)imgName {  
  15.     return [[UIImage imageNamed:imgName] resizeImage];  
  16. }  
  17.   
  18. - (UIImage *)resizeImage  
  19. {  
  20.     CGFloat leftCap = self.size.width * 0.5f;  
  21.     CGFloat topCap = self.size.height * 0.5f;  
  22.     return [self stretchableImageWithLeftCapWidth:leftCap topCapHeight:topCap];  
  23. }  
  24.   
  25. - (UIImage *)cut:(CGSize)sizeScale  
  26. {  
  27.     CGFloat width = self.size.width * sizeScale.width;  
  28.     CGFloat height = self.size.height * sizeScale.height;  
  29.     CGFloat x = (self.size.width -  width) * 0.5;  
  30.     CGFloat y = (self.size.height - height) * 0.5;  
  31.     CGRect rect = CGRectMake(x, y, width, height);  
  32.     CGImageRef ref = CGImageCreateWithImageInRect(self.CGImage, rect);  
  33.     return [UIImage imageWithCGImage:ref];  
  34. }  
  35.   
  36. @end  

posted on 2016-01-20 12:26  zhoup  阅读(881)  评论()    收藏  举报