Objective-C 中,字串與集合是最常使用的基礎型別。
可建立常數字串、格式化字串,也可讀寫檔案。比較字串可用 isEqualToString 或 compare。抽取子串可使用 substringToIndex、substringFromIndex 與 substringWithRange。
可變字串支援 appendString、insertString、deleteCharactersInRange 與 replaceCharactersInRange。
陣列可存放物件,常用 count、objectAtIndex、addObject、removeObjectAtIndex。列舉可用 NSEnumerator 或快速枚舉。
字典以 key-value 儲存資料,可用 objectForKey 取值;NSMutableDictionary 可隨時加入或移除鍵值。
若要將 CGRect 等非物件型別放入陣列,可用 NSValue 包裝。