如何将数组插入到sqlitedatabase列中以及如何在Uitableview单元格中显示。
这里我在 TableView 中显示数据,该数据保存在一个数组 (selectedDataArray) 中的选定单元格数据中。如何将 selectedDataArray 存储在 sqlite 数据库中。任何 body hlpme 代码。
最佳答案
SQlite 不支持数组插入。
将数组转换为字符串并插入数据库。
NSString *arrayString = [self.someArray componentsJoinedByString:@","];
[managedObject setValue:arrayString forKey:@"xyz"];
从数据库中获取字符串并转换为数组后。
NSArray *savedArray = [arrayString componentsSeparatedByString:@","];
现在您将在 uitableviewcell 中显示数组值。
关于mysql - 如何将数组插入sqlitedatabase列以及如何在Uitableview单元格中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17358320/