iOS開發中一些公用的頭文件



#ifndef UI_DEFINITIONS

#define UI_DEFINITIONS

#pragma mark UI相關常量

//導航欄高度
#define CONTENT_NAVIGATIONBAR_HEIGHT 44

//底部tabbar 高度
#define CONTENT_TABBAR_HEIGHT 49

//英文狀態下鍵盤的高度
#define ENGISH_KEYBOARD_HEIGHT 216

//屏幕寬度
#define SCREEN_WIDTH ([[UIScreen mainScreen]bounds].size.width)
//屏幕高度
#define SCREEN_HEIGHT ([[UIScreen mainScreen]bounds].size.height)

//搜索框frame
#define SEARCH_BAR_FRAME CGRectMake(0,0,SCREEN_WIDTH, 44)

//iPhone statusbar 高度
#define PHONE_STATUSBAR_HEIGHT  20

//iPhone 屏幕尺寸,已去掉status bar的高度
#define PHONE_SCREEN_SIZE  (CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT - PHONE_STATUSBAR_HEIGHT))

//判斷是否爲4寸屏iPhone
#define IS_IPHONE_568 ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)

//適配3.5寸屏和4寸品的圖片名
#define ADAPT_IMAGE_NAME(imageName) (IS_IPHONE_568 ? [NSString stringWithFormat:@"%@-568h", [imageName stringByDeletingPathExtension]]:imageName)
字體

//加粗字體
#define BOLDLABELFONT(fontSize) [UIFont boldSystemFontOfSize:fontSize]
//普通字體
#define LABELFONT(fontSize) [UIFont systemFontOfSize:fontSize]
//將圖片加入bundle文件
#define GET_IMAGE_FROM_BUNDLE_PATH(imageName,bundleName) [ResBundleUtils imageNamedFromImagesBundlePNG:imageName withSubPath:bundleName]

#endiform

相關文章
相關標籤/搜索