Answer the question
In order to leave comments, you need to log in
How to split row and populate tableview?
Good evening, I receive a json string [email protected]"1,2,3,4" I need to divide each number and fill in the table. array = [str componentsSeparatedByString: @","];Found this way but there are some problems with filling the table
Answer the question
In order to leave comments, you need to log in
The componentsSeparatedByString method is very nice for separation. You can also
[NSJSONSerialization JSONObjectWithData:]
you just need to fill the cells of the table with array elements?
Well, it's not difficult, I advise you to read about it (since this is the basis of the basics)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
//Поиск ячейки
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//Если ячейка не найдена
if (cell == nil) {
//Создание ячейки
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
// !!!
cell.textLabel.text = [students objectAtIndex:indexPath.row];
return cell;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question