1
我有一個NSObject
類叫做Post
。 A post
有財產URL
。當我的應用程序開始時,使用URL創建新帖子並添加到名爲_objects的數組中。當選擇表格單元格時,我想在_objects[indexPath.row]
中設置post.url
。從數組中獲取對象的屬性它在
添加到表:
NSMutableArray *newPosts = [[NSMutableArray alloc] initWithCapacity:0];
for (SomeElement *element in postNodes) {
Post *post = [[Post alloc] init];
[newPosts addObject:post];
post.title = [[element firstChild] content];
post.url = [element objectForKey:@"href"];
}
_objects = newPosts;
如果我打電話的時候,選擇了小區返回什麼simular _objects[indexPath.row]
。