Develop
2014.03.26 11:04
[ios] 유용한 매크로
조회 수 3656 댓글 0
# 유용한 매크로
#define ApplicationDelegate ((MyAppDelegate *)[[UIApplication sharedApplication] delegate]) #define UserDefaults [NSUserDefaults standardUserDefaults] #define SharedApplication [UIApplication sharedApplication] #define Bundle [NSBundle mainBundle] #define MainScreen [UIScreen mainScreen] #define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES #define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO #define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x #define NavBar self.navigationController.navigationBar #define TabBar self.tabBarController.tabBar #define NavBarHeight self.navigationController.navigationBar.bounds.size.height #define TabBarHeight self.tabBarController.tabBar.bounds.size.height #define ScreenWidth [[UIScreen mainScreen] bounds].size.width #define ScreenHeight [[UIScreen mainScreen] bounds].size.height #define TouchHeightDefault 44 #define TouchHeightSmall 32 #define ViewWidth(v) v.frame.size.width #define ViewHeight(v) v.frame.size.height #define ViewX(v) v.frame.origin.x #define ViewY(v) v.frame.origin.y #define SelfViewWidth self.view.bounds.size.width #define SelfViewHeight self.view.bounds.size.height #define RectX(f) f.origin.x #define RectY(f) f.origin.y #define RectWidth(f) f.size.width #define RectHeight(f) f.size.height #define RectSetWidth(f, w) CGRectMake(RectX(f), RectY(f), w, RectHeight(f)) #define RectSetHeight(f, h) CGRectMake(RectX(f), RectY(f), RectWidth(f), h) #define RectSetX(f, x) CGRectMake(x, RectY(f), RectWidth(f), RectHeight(f)) #define RectSetY(f, y) CGRectMake(RectX(f), y, RectWidth(f), RectHeight(f)) #define RectSetSize(f, w, h) CGRectMake(RectX(f), RectY(f), w, h) #define RectSetOrigin(f, x, y) CGRectMake(x, y, RectWidth(f), RectHeight(f)) #define DATE_COMPONENTS NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit #define TIME_COMPONENTS NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit #define FlushPool(p) [p drain]; p = [[NSAutoreleasePool alloc] init] #define RGB(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0] #define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
[출처] https://gist.github.com/mwaterfall/953656
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
957 | Develop | [ios] GMT Date와 Local Date 변환하기 | hooni | 2015.04.07 | 833 |
956 | Etc | 아이폰의 터치스크린 정확도 | hooni | 2015.04.01 | 1423 |
955 | Develop | [ios] 아이폰 앱 이름 및 버전 정보 | hooni | 2015.03.24 | 859 |
954 | Develop | [ios] 카메라 사용 권한 확인해서 분기하는 방법 | hooni | 2015.02.26 | 1875 |
953 | PPT | [ppt] iOS 플라랩#01(2015.02.26) 발표 자료 | hooni | 2015.02.25 | 738 |
952 | Develop | [ios] Touch ID 적용 샘플 코드 (예제) | hooni | 2015.02.23 | 673 |
951 | Develop | [펌] 게임 엔진 만든거 공개합니다. | hooni | 2015.02.21 | 2359 |
950 | Develop | [ios] StoryBoard(xib) 없이 프로젝트 만들기 | hooni | 2015.02.12 | 1073 |
949 | Develop | [ios] UIWebView에서 로컬에 있는 html 파일 불러오기 | hooni | 2015.02.10 | 897 |
948 | Develop | [ios] 로컬에 있는 JS 파일 웹뷰에서 동적으로 실행하기 | hooni | 2015.02.10 | 958 |
947 | Develop | [ios] 로컬에 있는 html 실행하기 | hooni | 2015.02.10 | 1035 |
946 | Develop | [ios] 앱의 로컬 js 파일에서 해당 프로젝트의 이미지 불러오기 | hooni | 2015.02.10 | 631 |