我有一个存储在Parse中的数组,我想计算数组中的对象,然后在标签中显示该数字。我已经能够计算对象,但由于某种原因无法弄清楚如何将它变成一个字符串。这是我的代码:
cell.CheckinLabel.text = (@"count = %d", [[imageObject objectForKey:@"Checkin"] count]);
NSLog(@"count = %d", [[imageObject objectForKey:@"Checkin"] count]);
任何帮助都将不胜感激。
答案 0 :(得分:1)
试试这个:
NSString *string = [NSString stringWithFormat:@"%d", [[imageObject objectForKey:@"Checkin"] count]];
yourlabel.text = string;
或者,
yourlabel.text = [NSString stringWithFormat:@"%d", [[imageObject objectForKey:@"Checkin"] count]];