Develop
2014.03.26 11:04
[ios] 유용한 매크로
조회 수 3658 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
717 | Develop | [git] 쉬운 버전관리 Git 설명 | hooni | 2015.08.18 | 880 |
716 | Develop | [html] HTML5 튜토리얼 링크 ㅋㅋ | hooni | 2013.04.23 | 12818 |
715 | Develop | [html] SVG(Scalable Vector Graphics) 간단 정리 | hooni | 2014.02.13 | 8836 |
714 | Develop | [html] 메타태그 사용예.. 은지나 바라~ | hooni | 2003.04.23 | 7236 |
713 | Develop | [html] 캐쉬된 웹페이지 사용하지 않도록 하는 방법 | hooni | 2003.04.23 | 13028 |
712 | Etc | [htm] DOM에 대해 ㅎㅎ | hooni | 2003.04.23 | 14718 |
711 | Develop | [ios] UIView 계층구조 | hooni | 2015.01.03 | 1132 |
710 | Develop | [ios] @property의 속성 (strong, weak, copy) 사용 경우 | hooni | 2014.08.08 | 1666 |
709 | Develop | [ios] AES256 알고리즘을 이용해 데이터 암호화/복호화 방법 | hooni | 2015.07.21 | 4109 |
708 | Develop | [ios] APNS 샘플 코드.. | hooni | 2013.06.27 | 0 |
707 | Develop | [ios] APNS 클라이언트 구현 (pdf) | hooni | 2013.06.27 | 15692 |
706 | Develop | [ios] APNS, Remote Push 사용자가 수신을 동의했는지 확인하기 | hooni | 2018.10.19 | 1265 |