70 lines
2.6 KiB
C
70 lines
2.6 KiB
C
//
|
|
// GIGA.h
|
|
// GIGA
|
|
//
|
|
// Created by lianxiang on 2018/8/13.
|
|
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
|
//
|
|
|
|
#ifndef GIGA_h
|
|
#define GIGA_h
|
|
|
|
#define UD_STADARDUD [NSUserDefaults standardUserDefaults]
|
|
|
|
#define UD_REMOVE_KEY(__KEY__) \
|
|
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__]; \
|
|
UD_SYNC
|
|
|
|
#define UD_GET_VALUE(__KEY__) [[NSUserDefaults standardUserDefaults] valueForKey:__KEY__];
|
|
|
|
#define UD_SET_KEY_VALUE(__KEY__, __VALUE__) \
|
|
[[NSUserDefaults standardUserDefaults] setValue:(__VALUE__) forKey:(__KEY__)]; \
|
|
UD_SYNC
|
|
|
|
#define UD_SYNC [[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
// MARK: NotificationCenter - Add
|
|
|
|
#define NC_ADD_TARGET_NAME_OBJECT(__target__, __sel__, __name__, __object__) [[NSNotificationCenter defaultCenter] addObserver:(__target__) selector:(__sel__) name:(__name__) object:(__object__)];
|
|
#define NC_POST_NAME_OBJECT(__name__,__object__) [[NSNotificationCenter defaultCenter] postNotificationName:(__name__) object:(__object__)];
|
|
|
|
#define NC_REMOVE_NAME(__target__,__name__,__object__) [[NSNotificationCenter defaultCenter] removeObserver:(__target__) name:(__name__) object:(__object__)];
|
|
|
|
// MAKR: Noti Names
|
|
#define USER_GUARD_DISSMISS @"userGaurdDissmiss"
|
|
#define APP_GUARD_DISSMISS @"APPGaurdDissmiss"
|
|
|
|
|
|
|
|
#define GIGARGB(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
|
|
|
|
#define GIGAUIColorFromRGB_A(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]
|
|
|
|
#define GIGAUIColorFromRGBA(rgbValue) [UIColor \
|
|
colorWithRed:((float)((rgbValue & 0xFF000000) >> 24))/255.0 \
|
|
green:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
|
|
blue:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
|
|
alpha:((float)(rgbValue & 0xFF))/255.0]
|
|
|
|
|
|
#define SCREEN [UIScreen mainScreen]
|
|
#define WIDTH self.view.frame.size.width
|
|
#define HEIGHT self.view.frame.size.height
|
|
#define KMainW [UIScreen mainScreen].bounds.size.width
|
|
#define KMainH [UIScreen mainScreen].bounds.size.height
|
|
|
|
#define ISIOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES : NO)
|
|
#define ISIOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? YES : NO)
|
|
#define ISIOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0 ? YES : NO)
|
|
|
|
#define weakify(var) __weak typeof(var) weakSelf = var
|
|
#define strongify(var) __strong typeof(var) strongSelf = var
|
|
|
|
#define textFontWeightSize(X,W) [UIFont systemFontOfSize:X *([UIScreen mainScreen].bounds.size.width / 320.0) weight:W]
|
|
|
|
|
|
#endif /* GIGA_h */
|