OC 常用宏

//常用宏

#define Maxw[[UIScreen mainScreen] bounds].size.width

#define Maxh[[UIScreen mainScreen] bounds].size.height

#define WS(ws)__weak __typeof(self) ws = self

#define SS(ss)__strong __typeof(ws)ss = ws

#define CG(x,y,w,h)CGRectMake(x,y,w,h)

#define CS(w,h)CGSizeMake(w,h)

#define Img(imageName)[UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]

#define RGB(rgb)[UIColor colorWithRed:((float)((rgb &0xFF0000) >>16))/255.0green:((float)((rgb &0xFF00) >>8))/255.0blue:((float)(rgb &0xFF))/255.0alpha:1.0]

#define RGBA(r,g,b,a)[UIColor colorWithRed:r/255.0green:g/255.0blue:b/255.0alpha:a]

#define CGRGBA(r,g,b,a)[[UIColor colorWithRed:r/255.0green:g/255.0blue:b/255.0alpha:a] CGColor]

#define FONT(a)[UIFont systemFontOfSize:a]

#define X(v)(v).frame.origin.x

#define Y(v)(v).frame.origin.y

#define W(v)(v).frame.size.width

#define H(v)(v).frame.size.height

#define MinX(v)CGRectGetMinX((v).frame)

#define MinY(v)CGRectGetMinY((v).frame)

#define MidX(v)CGRectGetMidX((v).frame)

#define MidY(v)CGRectGetMidY((v).frame)

#define MaxX(v)CGRectGetMaxX((v).frame)

#define MaxY(v)CGRectGetMaxY((v).frame)

#define AVERAGE(MAX,MIN,NUM)(MAX - MIN) / NUM

#define HERadiusTLUIRectCornerTopLeft

#define HERadiusTRUIRectCornerTopRight

#define HERadiusBLUIRectCornerBottomLeft

#define HERadiusBRUIRectCornerBottomRight

//获取版本

#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

#define CurrentSystemVersion [[UIDevice currentDevice] systemVersion]

//当前应用版本号

#define AppVersion [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]



#pragma mark - DEBUG#else




//定义是输出Log

#define DLog(format, ...)

#endif

//只输出类名

#define LogClassName DLog(@"")

#ifdef DEBUG

#define ULog(fmt, ...){ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__]delegate:nil cancelButtonTitle:@"Ok"otherButtonTitles:nil]; [alert show]; }

#else

#define ULog(...)

#endif

#ifdef DEBUG

//定义是输出Log

#define DLog(format, ...) NSLog(@"Line[%d] %s "format, __LINE__, __PRETTY_FUNCTION__,##__VA_ARGS__)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容