ios7下获取的屏幕高度
[UIScreen mainScreen].bounds.size.height=1024
ios8下获取的屏幕高度
[UIScreen mainScreen].bounds.size.height=768
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
height =[UIScreen mainScreen].bounds.size.height;
}else{
height =[UIScreen mainScreen].bounds.size.width;
}
常用宏···
//获得当前屏幕宽高点数(非像素)
#define kScreenHeight [UIScreen mainScreen].bounds.size.height
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
//ios7系统色系
#define kGreenColor [UIColor colorWithHexString:@"#44DB5E"];
#define kRedColor [UIColor colorWithHexString:@"#FF3824"];
#define kGrayColor [UIColor colorWithHexString:@"#8E8E93"];
#define kYellowColor [UIColor colorWithHexString:@"#FFCD00"];
#define kSkyBlueColor [UIColor colorWithHexString:@"#54C7FC"];
#define kOrangeColor [UIColor colorWithHexString:@"#FF9600"];
#define kGreenColor [UIColor colorWithHexString:@"#44DB5E"];
#define kPinkColor [UIColor colorWithHexString:@"#FF2851"];
#define KBlueColor [UIColor colorWithHexString:@"#0076FF"];
//判断iphone6
#define kiPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iphone6+
#define kiPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
//判断ipad
#define kiPad ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
系统色系需要UIColor扩展支持
#import <UIKit/UIKit.h>
#define RGBA_COLOR(R, G, B, A) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:A]
#define RGB_COLOR(R, G, B) [UIColor colorWithRed:((R) / 255.0f) green:((G) / 255.0f) blue:((B) / 255.0f) alpha:1.0f]
@interface UIColor (Hex)
+ (UIColor *)colorWithHexString:(NSString *)color;
//从十六进制字符串获取颜色,
//color:支持@“#123456”、 @“0X123456”、 @“123456”三种格式
+ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha;
@end