سؤال

Got a questions so I'm storing some data into an array from some json data the array is called stations and this is what it return when i log it in the function where I'm trying to print it.

self.stations = (
   24,
   33,
   8,
   41,
   60,
   73,
   49,
   12
)

i want to print this data in the detail of the label so currently I have

cell.detailTextLabel.text = [NSString stringWithFormat:@"( 0 / %@)  Computers Available", self.stations];

But when I run it the only thing that shows in the detail area of the label is ( 0 /

then it repeats that for all the cells. How do I got about turning this array into integers? i'm assuming this is happening because it is an ID but how do i take that and turn it into Ints? Any help would be appreciated.

هل كانت مفيدة؟

المحلول

If you want to show one value per cell then you probably want something like:

cell.detailTextLabel.text = [NSString stringWithFormat:@"( 0 / %@)  Computers Available", self.stations[indexPath.row]];

You are trying to show the entire array in each cell.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top