我在sqlite表中插入数据,然后在表View中显示该数据。问题是,当我插入ABC然后它显示在表ABC,但当我再次插入XYZ然后它只显示XYZ而不是ABC和XYZ。这是选择我插入的数据的方法:
NSMutableArray *tempArray3 = [[NSMutableArray alloc] init];
self.libraryArray = tempArray3;
[tempArray3 release];
[Coffee getInitialDataToDisplayL:[self getDBPath]];
添加数据方法:
- (void) addCoffee:(Coffee *)coffeeObj {
//Add it to the database.
[coffeeObj addCoffee];
int countone=[libraryArray count];
NSLog(@"count Before Adding is %d",countone);
//Add it to the coffee array.
[libraryArray addObject:coffeeObj];
int count=[libraryArray count];
NSLog(@"count After Adding is %d",count);
NSLog(@"Successfully added");
}