if (sqlite3_prepare_v2(dbHandlerPointerNote ,selectQuery , -1, &prepareStmtNote, NULL) == SQLITE_OK) {
while (sqlite3_step(prepareStmtNote) == SQLITE_ROW)
{
NSString *noteName = [[NSString alloc]initWithUTF8String:(const char *) sqlite3_column_text(prepareStmtNote, 0)];
[_notesArray addObject:noteName];
int noteid =sqlite3_column_int(prepareStmtNote, 1);
[_noteidArray addObject:[NSString stringWithFormat:@"%d",noteid]];
NSString *noteDate = [[NSString alloc]initWithUTF8String:(const char *) sqlite3_column_text(prepareStmtNote,2)];
[_notesDate addObject:noteDate];
// arrObj is a mutable arr
}
}
以上是我如何将对象添加到note_id
数组中。
这是我试图获取最后一个对象的方法:
_savedNoteid1=[[_modleClass.noteidArray lastObject]intValue];
但它不能正常工作。如何获取数组中的最后一个对象?