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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
361 | Develop | [asp] 폼 메일 소스 | hooni | 2013.04.23 | 7353 |
360 | Develop | [c] 스택/힙 오버플로우 테스트(overflow) | hooni | 2003.04.23 | 7326 |
359 | Develop | [c/c++] Makefile 사용하기.. ㅋㅋ | hooni | 2003.04.23 | 7323 |
358 | Develop | [c] 플러드 필링 (flood filling) 알고리즘.. | hooni | 2013.04.23 | 7319 |
357 | Develop | [php] 이미지 회전시키기(gd) | hooni | 2013.04.23 | 7318 |
356 | Develop | 객체지향 프로그래밍에 대한 개념.. (객체) | hooni | 2013.04.23 | 7312 |
355 | Develop | [jsp] 정적/동적(차트생성) 이미지 전달 | hooni | 2003.04.23 | 7307 |
354 | Develop | [c]디렉토리 탐색 | hooni | 2003.04.23 | 7305 |
353 | Develop | [c++] mfc로 만든 사용자 계정 리스트 출력(EnumUser) 프로그램 예제 | hooni | 2013.04.23 | 7292 |
352 | Develop | [pdf] C++ 국제 표준 문서 | hooni | 2013.04.23 | 7281 |
351 | Develop | [js] 초간단 현재 사이트 쿠키 확인하는 명령~ | hooni | 2003.04.23 | 7275 |
350 | Develop | [c] 신기한 atoi함수(www.game79.net) | hooni | 2003.04.23 | 7274 |