宏定义(备用)

来源:互联网 发布:软件授权码绑定 编辑:程序博客网 时间:2024/05/01 00:05

#pragma mark ---- AppDelegate
088//AppDelegate
089#define APPDELEGATE [(AppDelegate*)[UIApplication sharedApplication]  delegate]
090//UIApplication
091#define APPD  [UIApplication sharedApplication]
092#define rootNavVC (UINavigationController*)[[[[UIApplication sharedApplication] delegate] window] rootViewController]
093

094#define isPad  ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)

095#define isiPhone5 ([[UIScreen mainScreen]bounds].size.height == 568)
096
097
098



108#pragma mark ---- File  functions
109#define PATH_OF_APP_HOME    NSHomeDirectory()
110#define PATH_OF_TEMP        NSTemporaryDirectory()
111#define PATH_OF_DOCUMENT    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
112
113
114#pragma mark ---- color functions
115#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]

116#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)]
117

118119//get the  size of the Screen
120#define SCREEN_HEIGHT [[UIScreen mainScreen]bounds].size.height
121#define SCREEN_WIDTH [[UIScreen mainScreen]bounds].size.width
122#define HEIGHT_SCALE  ([[UIScreen mainScreen]bounds].size.height/480.0)
123
124//get the  size of the Application
125#define APP_HEIGHT [[UIScreen mainScreen]applicationFrame].size.height
126#define APP_WIDTH [[UIScreen mainScreen]applicationFrame].size.width
127
128#define APP_SCALE_H  ([[UIScreen mainScreen]applicationFrame].size.height/480.0)
129#define APP_SCALE_W  ([[UIScreen mainScreen]applicationFrame].size.width/320.0)
130
131//get the left top origin's x,y of a view
132#define VIEW_TX(view) (view.frame.origin.x)
133#define VIEW_TY(view) (view.frame.origin.y)
134
135//get the width size of the view:width,height
136#define VIEW_W(view)  (view.frame.size.width)
137#define VIEW_H(view)  (view.frame.size.height)
138
139//get the right bottom origin's x,y of a view
140#define VIEW_BX(view) (view.frame.origin.x + view.frame.size.width)
141#define VIEW_BY(view) (view.frame.origin.y + view.frame.size.height )
142
143//get the x,y of the frame
144#define FRAME_TX(frame)  (frame.origin.x)
145#define FRAME_TY(frame)  (frame.origin.y)
146//get the size of the frame
147#define FRAME_W(frame)  (frame.size.width)
148#define FRAME_H(frame)  (frame.size.height)
149
150 

原创粉丝点击