之間有什麼區別self.currentProperty = [NSMutableString string]之後,我在xcode 4窗口底部的東西上看到了無效的表達式(你稱之爲什麼?變量和表達式等)[NSMutableString string]和「」
如何初始化self.currentProperty,它是一個NSMutableString對象爲空字符串?
之間有什麼區別self.currentProperty = [NSMutableString string]之後,我在xcode 4窗口底部的東西上看到了無效的表達式(你稱之爲什麼?變量和表達式等)[NSMutableString string]和「」
如何初始化self.currentProperty,它是一個NSMutableString對象爲空字符串?
您可以使用:
self.currentProperty = [NSMutableString stringWithCapacity:0];
但
self.currentProperty = [NSMutableString string];
也應該沒問題。
你能告訴我們你的財產是如何申報的嗎?
他們的意思完全一樣嗎?即將self.currentProperty設置爲空字符串>? – 2011-05-10 09:48:54
@Jim Thio我不知道這兩個類方法是如何實現的,但都返回一個自動釋放的實例,聲明所有權使用點語法來使用合成的setter,假設屬性被聲明爲「@property (retatin)......;'; – 2011-05-16 10:03:52
[NSMutableString string]本身沒有任何問題。你看到什麼錯誤?如果無法描述,請抓取屏幕截圖。 – 2011-05-07 17:11:34