1
我在數組一樣,存儲數據..如何從數組中刪除對象,數組包含字典
while ([delegate_obj.Recordsetmaster next])
{
NSMutableDictionary *local_DICT = [NSMutableDictionary new];
NSString *str_id = [delegate_obj.Recordsetmaster stringForColumn:@"category_id"];
[local_DICT setObject:str_id forKey:@"category_id"];
NSString *str_name = [delegate_obj.Recordsetmaster stringForColumn:@"category_name"];
[local_DICT setObject:str_name forKey:@"category_name"];
NSString *str_status = [delegate_obj.Recordsetmaster stringForColumn:@"status"];
[local_DICT setObject:str_status forKey:@"status"];
NSString *str_image = [delegate_obj.Recordsetmaster stringForColumn:@"image"];
[local_DICT setObject:str_image forKey:@"image"];
[category_array addObject:local_DICT];
}
現在我想刪除陣列5索引值如何做到這一點?
從'category_array'? – Paulw11
[category_array removeObjectAtIndex:3];它會崩潰。 –
總是一個最佳實踐 - 在刪除特定索引上的項目之前,檢查'category_array'的大小。而且,無論您迄今爲止顯示的任何代碼如何,您都需要檢查執行「while」循環的次數,因爲這將控制您的數組大小。 – Abhinav