Develop
2014.03.26 11:04

[ios] 유용한 매크로

Views 3654 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
21 System/OS [펌] 마이크로서비스, 모노리포, SRE, ... 덮어놓고 구글 따라하면 안 되는 기술들 file hooni 2020.10.15 949
20 Develop [ubuntu] 우분투 18.04에 PHP5 설치하기 hooni 2020.11.14 945
19 Develop [kotlin] 코틀린 안드로이드 앱 버전/빌드 정보 hooni 2020.12.15 822
18 Develop [swift] NotificationCenter 간단 예제 file hooni 2021.01.27 8115
17 Develop [swift] popToRoot 모달뷰, 네비게이션컨트롤러 한꺼번에 닫기 file hooni 2021.01.29 1386
16 Develop [js] show/hide 이벤트 감시 (Observing show/hide event) hooni 2021.02.03 2586
15 Develop [vim] vim 명령으로  문자 제거하기 (remove 65279 bomb) hooni 2021.02.03 1164
14 Develop [swift] 실행시간 측정하기 hooni 2021.09.14 676
13 Develop [iOS] Xcode 불필요한 캐시 삭제하기 hooni 2021.10.12 1794
12 Develop [iOS] 시뮬레이터에 푸시 알림을 보내는 방법 file hooni 2021.10.13 1823
11 Develop macOS에 node, npm 설치하기 (homebrew) file hooni 2021.11.06 1146
10 System/OS [apache2] Redirect HTTP to HTTPS file hooni 2022.02.03 688
9 System/OS 개인적으로 쓰고 있는 zshrc 파일 hooni 2022.02.25 831
8 System/OS 맥에서 포트 확인하고 닫기 (mac) hooni 2022.03.22 898
7 Develop [ios] Pod 특정 버전 설치하고 사용하기 hooni 2022.05.28 1535
6 Develop [ios] 여러 버전의 Xcode 사용하기 hooni 2022.05.28 673
Board Pagination Prev 1 ... 70 71 72 73 74 Next
/ 74