我正在使用下面的代码创建一个表。我[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance
在
label.text = rs[colNum++];
我如何解决它?提前致谢。
NSInteger rowNum = 0;
NSArray *columnWidths = @[@(50), @(120), @(75), @(75)];
CGFloat rowHeight = 24.0;
FMResultSet *rs = [db executeQuery:sql];
while ([rs next])
{
CGFloat x = 0.0;
NSInteger colNum = 0;
for (NSNumber *columnWidth in columnWidths)
{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x,
rowHeight * rowNum,
[columnWidth floatValue],
rowHeight)];
label.textAlignment = NSTextAlignmentCenter;
label.layer.borderColor = [UIColor blackColor].CGColor;
label.layer.borderWidth = 1.0;
label.text = rs[colNum++];
[self.view addSubview:label];
x += [columnWidth floatValue];
}
rowNum++;
}
[rs close];