Develop
2014.03.26 11:04

[ios] 유용한 매크로

Views 3652 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

# 유용한 매크로

#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

?

List of Articles
No. Category Subject Author Date Views
773 Develop [ios] Background 에서 네트워크 사용 file hooni 2013.07.22 11509
772 Develop [ios] App States file hooni 2013.07.22 13193
771 Etc 영어의 12 시제 (The twelve tenses of English) hooni 2013.07.12 15699
770 System/OS [mac] 컨텍스트(Context) 메뉴 "다음으로 열기" 내용 정리 hooni 2013.07.10 18797
769 Develop git 브런치 배우기 (링크) hooni 2013.07.09 20571
768 Develop GCM 사용하기 3 (JSP로 GCM 푸시 서버 만들기) 4 file hooni 2013.07.06 25315
767 Develop GCM 사용하기 2 (단말에 GCM 구현하기) file hooni 2013.07.06 23248
766 Develop [android] GCM 사용하기 1 (GCM 서비스 신청하기) file hooni 2013.07.06 51355
765 Develop [ios] APNS 샘플 코드.. secret hooni 2013.06.27 0
764 Develop [ios] APNS 클라이언트 구현 (pdf) file hooni 2013.06.27 15689
763 Develop [ios] PHP로 APNS 프로바이더~ file hooni 2013.06.27 16844
762 Etc 영어 관련 토렌트 secret hooni 2013.06.25 0
761 Etc 영어 아주 쉬운 영작문 강의 01~60 secret hooni 2013.06.25 0
760 Etc 성문 종합 영어 정리된 pdf 파일 file hooni 2013.06.25 30955
759 Develop 프로그래밍에서 foo, bar 함수의 유래 file hooni 2013.06.25 21253
758 Etc 영작 연습을 위한 실용영어 문장 1001개 (1~500) hooni 2013.06.21 30422
Board Pagination Prev 1 ... 24 25 26 27 28 ... 74 Next
/ 74