Misc’ 카테고리의 보관물

iOS source – version check

금요일, 11월 16th, 2012
/*
 *  System Versioning Preprocessor Macros
 */ 

#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)

/*
 *  Usage
 */ 

if (SYSTEM_VERSION_LESS_THAN(@"4.0")) {
    ...
}

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"3.1.1")) {
    ...
}

iOS에서 지원하는 폰트

금요일, 1월 6th, 2012

iOS에서 지원하는 폰트

I’ve seen many times @property defined as nonatomic for performance reasons. Is there any evidence that this is worth it?

화요일, 11월 22nd, 2011

You either have ARC on or off for a particular file. If its on you cannot use retain release autorelease etc… Instead you use strong weak for properties or __strong __weak for local variables (defaults to __strong). Strong is the equivalent to retain, however ARC will manage the release for you.

The only time you would want to use weak, is if you wanted to avoid retain cycles (e.g. the parent retains the child and the child retains the parent so neither is ever released).

The ‘toll free bridging’ part (casting from NS to CF) is a massive headache by the looks of things. You still have to manually manage CFRelease() and CFRetain() for CF objects. When you convert them back to NS objects you have to tell the compiler about the retain count so it know what you have done.

http://stackoverflow.com/questions/7912555/weak-and-strong-property-setter-attributes-in-objective-c

Weak and strong property setter attributes in Objective-C

화요일, 11월 22nd, 2011

What is the difference between weak and strong property setter attributes in Objective-C?

@property(retain, [weak/strong]) __attribute__((NSObject)) CFDictionaryRef myDictionary; 

What is the impact and benefit?

I heard that weak is not available on iOS 4 and we need to use assign.

Is weak similar to assign?

 

You either have ARC on or off for a particular file. If its on you cannot use retain release autorelease etc… Instead you use strong weak for properties or __strong __weak for local variables (defaults to __strong). Strong is the equivalent to retain, however ARC will manage the release for you.

The only time you would want to use weak, is if you wanted to avoid retain cycles (e.g. the parent retains the child and the child retains the parent so neither is ever released).

The ‘toll free bridging’ part (casting from NS to CF) is a massive headache by the looks of things. You still have to manually manage CFRelease() and CFRetain() for CF objects. When you convert them back to NS objects you have to tell the compiler about the retain count so it know what you have done.

 

http://stackoverflow.com/questions/7912555/weak-and-strong-property-setter-attributes-in-objective-c

선택과 집중

금요일, 10월 7th, 2011

어떤 일이든지 집중하지 않고 이룰수 일은 없다. 스티브 잡스는 기존의 제품에서 쓸데없는 기능은 줄이고 가장 효율적인 인터페이스를 만들었고 늘 단순함과 집중력을 강조했다 여러가지를 한꺼번에 이루려고 노력하는건 욕심일뿐이다. 가장 중요한 것을 당장 급해보이는 것보다 중요시 여기고 그것에 집중하는게 능력이다.