2010-06-10 63 views

回答

6

您需要先投的對象。

((MyObjectType *) [myArray objectAtIndex:0]).intProperty = 12345;

0

首先,你需要將ID存儲在一個變量,像

(id) myObject = [myArray objectAtIndex:0]; 

然後你就可以對其進行操作:

myObject.intProperty = 12345; 

,再存放起來:

[myArray removeObjectAtIndex:0]; // Remove it before setting it again 
[myArray insertObject:myObject atIndex:0]; 

編輯:您也可以用雅各布的方式,這是好多了:)

0

其合成的setter設置屬性更短的(並且,我的眼睛,更清潔的閱讀和理解):

[[myArray objectAtIndex:0] setIntProperty:12345];