1.+(void)initialize :第一次使用一个类的时候会调用(一个类只会掉一次),比如设置导航栏的主题,这个项目只设置一次
2.取出导航栏对象:[UINavigationBar apperance]
3.设置导航栏背景 setBackgroundImage :forBarMetrics
4.在设置导航栏背景的时候会把状态栏的颜色一起同化掉:(ios7一般不需要)
[UIApplication sharedApplication].statusBarStyle= UIStatusBarBlackOpaque;这样导航栏就又变回黑色了。
5.设置导航栏文字的属性
NSMutableDictionar *text =[NSMutableDictionar dictionary];
//设置文字的颜色
text[UITextAttributeTextColor] =[UIColor blackColor];
//设置字体没有阴影
text[UITextAttributeTextShadowoffset] =[NSValue valueWithUIoffset:UioffsetZero];
6.导航栏按钮的设置
//拿出导航栏
[UIBarButtonItem apperance]
//设置按钮
self.navigationItem.rightBarButtonItem =[UIBarButtonitem alloc]init]
7.只要自己设置了导航栏按钮的主题,系统的就会被覆盖
//包装一个view在添加到导航栏上,可以自定义一个按钮
8.当导航栏上的BarButtonitem时纯图片的时候用:[UIBarButtonitem alloc]initWithCustomView(UIview)]
9.一般会自己写一个自己的NSLog, 在pch文件中,
#ifdef DEBUG
GMLog(. . .)NSLog(__VA_ARGS__)
else
define GMLog(. . .)
#endif
10.判断是否为ios7:
[UIDevice currentDevice].systemVersion doubleValue]>=7.0)
11.获取RGB颜色
#define CGColor(r,g,b)[UIColor colorWithRed:(r)/255.0 green/255.0 blue/255.0 alpha:1.0]