user3255746
user3255746

Reputation: 1437

Count objects in array for string

I have an array stored in Parse and I wanted to count the objects in the array and then display that number in a label. I have been able to count the objects but for some reason can not figure out how to turn it into a string. Here is my code:

    cell.CheckinLabel.text = (@"count = %d", [[imageObject objectForKey:@"Checkin"] count]);
    NSLog(@"count = %d", [[imageObject objectForKey:@"Checkin"] count]);

Any help would be appreciated.

Upvotes: 0

Views: 76

Answers (1)

Rashad
Rashad

Reputation: 11197

Try this:

NSString *string = [NSString stringWithFormat:@"%d", [[imageObject objectForKey:@"Checkin"] count]];
yourlabel.text = string;

Or,

yourlabel.text = [NSString stringWithFormat:@"%d", [[imageObject objectForKey:@"Checkin"] count]];

Upvotes: 1

Related Questions