我使用2個sqlite數據庫文件。我該如何修改NSMutableArray屬性?
1)從sqlite數據庫中填充項目。
@property (nonatomic, strong) NSMutableArray *items;
.......
FMResultSet *results = [db1 executeQuery:query];
while ([results next]) {
Book *book = [[Book alloc] init];
book.content = [results stringForColumn:@"Zcontent"];
book.title = [results stringForColumn:@"Ztitle"];
book.idx = [results intForColumn:@"Zidx"];
book.highlight_YN = NO;
[items addObject:book];
[book release];
}
2)在此之後,從其它-B-源碼分貝選擇條目。
FMDatabase *userDB = [FMDatabase databaseWithPath:userfmdbPath];
NSString *query2 = [NSString stringWithFormat:@"SELECT zidx, highlight_YN FROM zHighlight where zbook = %d and zchapter = %d order by zidx ", pBook,pChapter];
FMResultSet *userresults = [userDB executeQuery:query2];
3)問:我想用userresults
結果與results
相比,修改項目的屬性(highlight_YN
) - zidx
。
如何修改NSMutableArray
屬性?
我沒有在你的代碼中看到NSMutableArray。事實上,我看到了各種各樣的問題(比如'[addObject:bible]'中的'聖經'來自哪裏?)。請修改您的問題以清理您的代碼並引入一個NSMutableArray。 –
@Michael Dautermann對不起!我遺漏了一些代碼。謝謝!!我的問題被編輯。 ^^ * – hyekyung