//e.g.
#ifndef SWITCH_CASE
#define SWITCH(_str) for(NSString *_s = (_str);;)
#define CASE(_case) if([_s isEqualToString:(_case)])
#define DEFAULT
#endif /*SWITCH_CASE*/
目前分類:Objective-C (8)
- Feb 27 Sat 2016 15:11
note - How to resolve the NSString cannot use in Switch condition
- Feb 27 Sat 2016 12:37
Preprocessors - Conditional Compilation
Conditional compilation是為了避免無謂的重複引用header / source file所產生地。
寫法與常見的Programming Language一樣,以下就直接觀看程式碼,了解使用方法:
- Feb 21 Sun 2016 16:21
Memory management ARC / MRR
- Feb 21 Sun 2016 15:35
difference between Instance method and Class method
- Feb 21 Sun 2016 15:06
Message expression 宣告方法的語法 method / function
以下為範例:
+(void) methodName;
//沒有參數的版本。
-(returnType) methodName:(firstValueType) firstValueName;
//一個參數的版本。
-(returnType) methodName:(firstValueType) firstValueName
andSecondValue:(secondValueType) secondValueName
andThirdValue:(thirdValueType) thirdValueName;
//if you wanted input value more ,and so on...
//多個參數的版本。
/*---------------------------------------------------------*/
[aObject callAnInstanceMethod]
//單一訊息
[[drinkSerial getIndexOfObject: @"Juice"] fillTheDrink]
//巢狀訊息
- Feb 21 Sun 2016 14:48
@property and @synthesize
- Feb 21 Sun 2016 12:23
MVC important in Objective-C
iOS裏,所有的設計都遵循於MVC pattern,這是為何要了解MVC的所在,也是所有想寫iOS的設計者必須了解的原理。
須特別注意的是iOS裡,UI是屬於View,而不是Controller。
- Feb 20 Sat 2016 22:45
簡介 程式碼區塊 與 副檔名