[objc] OS version check

iPhone 2013. 9. 27. 12:44



#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

and use them like this:

if (SYSTEM_VERSION_LESS_THAN(@"5.0")) {
    // code here
}

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
    // code here
}





http://stackoverflow.com/questions/7848766/how-can-we-programmatically-detect-which-ios-version-is-device-running-on

Posted by tenn
,

[mac] 영역 복사

iPhone 2013. 9. 25. 14:09

option + 드래깅 : 원하는 영역을 선택할 수 있다

Posted by tenn
,


- (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets


가로로 늘릴 때는 UIEdgeInsets의 top, bottom은 0.


참고 : http://www.appcoda.com/customize-navigation-bar-back-butto/

(그림 보면 이해가 쉬움)



** 다음의 경우에는 쓰면 안됨.

중간 부분의 이미지가 질감인 경우. (타일패턴으로 채우기때문에 부자연스럽게 보임)





Posted by tenn
,