문제

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