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 [c++] 기초강좌 #04(클래스) hooni 2003.04.23 11830
772 Develop JSON, BSON 변환 file hooni 2013.04.23 11814
771 Develop [ios] iOS In App Purchase 코드 부분 샘플 1 hooni 2013.11.20 11758
770 Develop [php] 배열 관련 함수 설명 ㅎㅎ hooni 2003.04.23 11746
769 Develop [php] whois정보 조회 프로그램 hooni 2003.04.23 11733
768 Develop [ios] UIWebView 쿠키 유지 hooni 2014.01.16 11704
767 Develop [vbs] CD롬 뱉는 스크립트.. hooni 2003.04.23 11699
766 System/OS [unix] 유닉스 csh에서 환경변수 등록 hooni 2003.04.23 11697
765 Develop [c++] String Tokenizer (나중에 c 코드로 변경해서 사용할 것) hooni 2013.04.23 11690
764 PPT [network] tcp/ip 설명 html파일 9장(ppt 포함) file hooni 2013.04.23 11650
763 System/OS php.ini 설정 안됐을때.. ㅋㅋ hooni 2013.04.23 11639
762 Develop [java] 초간단 싱글톤(Singleton) 패턴 샘플 코드 file hooni 2013.11.18 11593
761 Develop [php] 쉘에서 실행할 때 인수(파라미터) 받기.. hooni 2003.04.23 11588
760 Develop [c] 도스 공격(DoS Attack) 프로그램 file hooni 2013.04.23 11575
759 Develop [c] 시간 관련 함수 설명과 예제.. file hooni 2003.04.23 11523
758 Develop [c] home env stack overflow hooni 2003.04.23 11515
Board Pagination Prev 1 ... 24 25 26 27 28 ... 74 Next
/ 74