Develop
2014.03.26 11:04
[ios] 유용한 매크로
조회 수 3701 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
573 | Develop | [ios] 기본 네비게이션바의 타이틀, back버튼 위치와 속성 변경 | hooni | 2016.05.16 | 2192 |
572 | Develop | [ios] 구분자로 문자열 자르기 (split) | hooni | 2013.04.23 | 26321 |
571 | Develop | [ios] 개발 기초 가이드 링크.. | hooni | 2013.04.23 | 31424 |
570 | Develop | [ios] 간단한 방법으로 OS버전 확인하기. | hooni | 2013.09.24 | 13393 |
569 | Develop | [ios] Xcode의 디버그 모드에서 콜스택 | hooni | 2015.01.03 | 1114 |
568 | Develop | [ios] Xcode에서 특정 파일만 ARC 따로 설정하는 방법 | hooni | 2017.03.29 | 1084 |
567 | Develop | [ios] XCode에서 Provisioning Profile 여러개 중복될 때 | hooni | 2014.06.26 | 2949 |
566 | Develop | [ios] Xcode를 사용해서 Static Library 만들기 (시뮬레이터 + 디바이스) | hooni | 2015.01.03 | 3403 |
565 | Develop | [iOS] Xcode 불필요한 캐시 삭제하기 | hooni | 2021.10.12 | 1986 |
564 | Develop | [ios] Xcode cannot run using the selected device | hooni | 2014.08.14 | 1926 |
563 | Develop | [ios] WWDC 2015 샘플 소스 코드 통합파일 | hooni | 2015.07.20 | 803 |
562 | Develop | [ios] VIN Scanner (VIN barcode) 스캐너 | hooni | 2017.09.16 | 788 |