Develop
2014.03.26 11:04
[ios] 유용한 매크로
Views 3703 Comment 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
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
513 | Develop | [php] 자바스크립트 개판 만들기.. | hooni | 2013.04.23 | 7688 |
512 | Develop | SVN 초간단 사용하기 | hooni | 2014.02.28 | 7684 |
511 | Develop | [c#] BFilter 툴바 소스 코드 ㅎㅎ | hooni | 2013.04.23 | 7672 |
510 | Develop | [java] 파일 라인수 계산하는 프로그램 (하위 디렉토리까지..) | hooni | 2013.04.23 | 7667 |
509 | Develop | [js] 핫키(단축키) 구현방법 | hooni | 2003.04.23 | 7656 |
508 | Develop | [c#]업글 뉴 툴바 개인적으로 만든거.. (new) ㅋㅋ | hooni | 2013.04.23 | 7651 |
507 | Develop | [c] OpenGL 관측점 이동 | hooni | 2003.04.23 | 7646 |
506 | Develop | [js] 자바스크립트와 정규표현식 메뉴얼 (chm 형식) | hooni | 2013.04.23 | 7645 |
505 | System/OS | HTTPS와 SSL 인증서 | hooni | 2014.03.11 | 7643 |
504 | Develop | [c++] winsock을 이용한 서버,클라이언트와 ssl서버,클라이언트 | hooni | 2013.04.23 | 7643 |
503 | Develop | [js] 비만 지수 측정(BMI) ㅎㅎ | hooni | 2013.04.23 | 7639 |
502 | Develop | [c++] 초간단 스택 두 가지 방식(class, struct) | hooni | 2013.04.23 | 7638 |