Contents

Develop
2014.03.26 11:04

[ios] 유용한 매크로

조회 수 3658 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

# 유용한 매크로

#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
번호 분류 제목 글쓴이 날짜 조회 수
969 Develop Laravel 5 Failed opening required bootstrap/../vendor/autoload.php hooni 2018.01.24 1665
968 Develop [ios] @property의 속성 (strong, weak, copy) 사용 경우 hooni 2014.08.08 1667
967 Develop [c] 한글 문자열 출력 hooni 2015.11.10 1685
966 Develop [python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기) hooni 2019.12.06 1696
965 System/OS [linux] CentOS 에 APM 설치하기 hooni 2015.01.02 1698
964 Develop [php] mysql_ 과 mysqli_ 의 차이 hooni 2017.12.01 1700
963 System/OS CentOS 에서 Cacti 설치하기 hooni 2015.01.02 1772
962 Develop [ios] Xcode cannot run using the selected device hooni 2014.08.14 1799
961 Develop [swift] UIView에서 subview 찾기 hooni 2022.12.09 1804
960 Etc 인증서 *.p12 파일을 *.pem 파일로 변환 hooni 2015.04.30 1809
959 Develop [iOS] Xcode 불필요한 캐시 삭제하기 hooni 2021.10.12 1810
958 System/OS [mac] 맥에서 기본 실행 앱 변경하기 file hooni 2018.03.02 1817
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 ... 98 Next
/ 98