CG_INLINE void
GCDDelay(int64_t delayInSeconds,dispatch_block_t block){
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(),block);
}
CG_INLINE void
GCDOnce( dispatch_once_t onceToken,DISPATCH_NOESCAPE dispatch_block_t block){
dispatch_once ( &onceToken, block);
}
CG_INLINE CGFloat
WIDTH(){
static CGFloat ScreenWidth;
static dispatch_once_t onceToken;
GCDOnce(onceToken,^{
ScreenWidth = CGRectGetWidth([UIScreen mainScreen].bounds);
});
return ScreenWidth;
};
CG_INLINE CGFloat
HEIGHT(){
static CGFloat ScreenHeight;
static dispatch_once_t onceToken;
GCDOnce(onceToken,^{
ScreenHeight = CGRectGetHeight([UIScreen mainScreen].bounds);
});
return ScreenHeight;
};
CG_INLINE CGRect
SCREEN(){
static CGRect ScreenRect;
static dispatch_once_t onceToken;
GCDOnce(onceToken,^{
if (CGRectIsEmpty(ScreenRect) || CGRectIsNull(ScreenRect)) {
ScreenRect = [UIScreen mainScreen].bounds;
}
});
return ScreenRect;
};
CG_INLINE CGFloat
FontScale(){
static CGFloat FScale;
static dispatch_once_t onceToken;
GCDOnce(onceToken,^{
FScale = 72.0/96.0;
});
return FScale;
};
CG_INLINE CGFloat
SizeScaleX(){
static CGFloat autoSizeScaleX;
static dispatch_once_t onceToken;
GCDOnce(onceToken,^{
autoSizeScaleX = (WIDTH()>480?WIDTH()/320.0:1.0);
});
return autoSizeScaleX;
};
CG_INLINE CGFloat
SizeScaleY(){
static CGFloat autoSizeScaleY;
static dispatch_once_t onceToken;
GCDOnce(onceToken,^{
autoSizeScaleY = (WIDTH()>480?HEIGHT()/568.0:1.0);
});
return autoSizeScaleY;
};
CG_INLINE CGRect
CGLFLMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height)
{
CGRect rect;
rect.origin.x = x *SizeScaleX();
rect.origin.y = y *SizeScaleY();
rect.size.width = width *SizeScaleX();
rect.size.height = height *SizeScaleY();
return rect;
};
CG_INLINE CGPoint
CGPointLFLMake(CGFloat x, CGFloat y)
{
CGPoint pointLFL;
pointLFL.x = x * SizeScaleX();
pointLFL.y = y * SizeScaleY();
return pointLFL;
};
CG_INLINE CGSize
CGSizeLFLMake(CGFloat width, CGFloat height)
{
CGSize sizeLFL;
sizeLFL.width = width* SizeScaleX();
sizeLFL.height = height* SizeScaleY();
return sizeLFL;
};