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