1 2 #define OS_VERSION [UIDevice currentDevice].systemVersion.floatValue
[这是什么?]
App 获取 App基本信息 1.5~ 1 2 3 4 #define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString" ] #define APP_BUILD [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion" ] #define APP_NAME [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName" ]
Application 获取全局基本信息 2.0~ 1 #define APP_DELEGATE APPLICATION.delegate
1.5~ 1 2 3 4 5 6 7 #define APPLICATION [UIApplication sharedApplication] #define WINDOW APPLICATION.keyWindow #define STATUSBAR_HEIGHT [APPLICATION statusBarFrame].size.height #define SAFEAREA_INSETS WINDOW.safeAreaInsets #define USER_DEFAULTS [NSUserDefaults standardUserDefaults] #define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]
ViewController 获取 ViewController基本信息 2.0~ 1 #define NAVIGATION_BAR ((EFNavigationBar *)NAVIGATION_CONTROLLER.navigationBar)
1.5~ 1 2 3 4 5 6 7 #define NAVIGATION_CONTROLLER ((EFBaseNavigationController *)self.navigationController) #define NAVI_CTRL_ROOT_VC NAVIGATION_CONTROLLER.viewControllers.firstObject #define NAVIGATION_HEIGHT FRAME_HEIGHT(NAVIGATION_CONTROLLER.navigationBar) #define TOP_LAYOUT_HEIGHT (STATUSBAR_HEIGHT+NAVIGATION_HEIGHT) #define TOOLBAR_HEIGHT FRAME_HEIGHT(NAVIGATION_CONTROLLER.toolbar) #define TABBAR_HEIGHT FRAME_HEIGHT(self.tabBarController.tabBar)
CGRect 2.0~ 1 2 #define CENTER_X(v) (v.center.x) #define CENTER_Y(v) (v.center.y)
1.5~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #define SCREEN_WIDTH FRAME_WIDTH(WINDOW) #define SCREEN_HEIGHT FRAME_HEIGHT(WINDOW) #define SCREEN_CENTER CENTER(WINDOW) #define FRAME_ORIGIN(v) (v.frame.origin) #define FRAME_X(v) (v.frame.origin.x) #define FRAME_Y(v) (v.frame.origin.y) #define FRAME_SIZE(v) (v.frame.size) #define FRAME_WIDTH(v) (v.frame.size.width) #define FRAME_HEIGHT(v) (v.frame.size.height) #define BOUNDS_ORIGIN(v) (v.bounds.origin) #define BOUNDS_X(v) (v.bounds.origin.x) #define BOUNDS_Y(v) (v.bounds.origin.y) #define BOUNDS_SIZE(v) (v.bounds.size) #define BOUNDS_WIDTH(v) (v.bounds.size.width) #define BOUNDS_HEIGHT(v) (v.bounds.size.height) #define CENTER(v) (v.center)
UIKit 2.0~ 新的工具方法 COLOR_HEXSTRING(hexString)和 COLOR_HEXSTRING_ALPHA(hexString, alphaValue)现已可用,颜色显示更为准确,浏览 EFUtils.h了解更多。(New utils COLOR_HEXSTRING(hexString) and COLOR_HEXSTRING_ALPHA(hexString, alphaValue) are available, color now look so close, see EFUtils.h for more.)
1 2 #define COLOR_RGB(rgbValue) [EFUtils colorWithRGB:rgbValue] #define COLOR_RGB_ALPHA(rgbValue, alphaValue) [EFUtils colorWithRGB:rgbValue alpha:alphaValue]
1.5~ 1 2 3 4 5 6 7 #define FONT_SIZE(s) [UIFont systemFontOfSize:s] #define FONT_SIZE_WEIGHT(s, w) [UIFont systemFontOfSize:s weight:w] #define FONT_NAME_SIZE(f, s) [UIFont fontWithName:f size:s] #define IMAGE(i) [UIImage imageNamed:i]
1.5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #define COLOR_RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] #define COLOR_RGB_ALPHA(rgbValue, alphaValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]
2.0~ 1 2 3 4 5 6 7 8 #define STRING_FORMAT(f, ...) [NSString stringWithFormat:f, ##__VA_ARGS__] #define LOG_FORMAT(f, ...) NSLog((@"[LOG]%s(line %d): " f), __FUNCTION__, __LINE__, ##__VA_ARGS__) #define EFDeprecated(d) __attribute__((deprecated(d))) #define WeakObject(o) autoreleasepool{} __weak typeof(o) o##Weak = o #define StrongObject(o) autoreleasepool{} __strong typeof(o) o = o##Weak
1.5~ 1 2 3 4 5 6 7 8 #define RUN_AFTER(s, b) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(s * NSEC_PER_SEC)), dispatch_get_main_queue(), b)
1.5 1 2 3 4 5 6 7 #define FORMAT_STRING(f, ...) [NSString stringWithFormat:f, ##__VA_ARGS__] #define LOG(f, ...) NSLog((@"[LOG]%s(line %d): " f), __FUNCTION__, __LINE__, ##__VA_ARGS__) #define WeakObj(o) autoreleasepool{} __weak typeof(o) o##Weak = o #define StrongObj(o) autoreleasepool{} __strong typeof(o) o = o##Weak
更新内容
Application新方法
ViewController新方法
CGRect新方法
UIKit新方法
Tools新方法