开发者

UITableView Cell Dynamic Array not Loading

开发者 https://www.devze.com 2023-04-01 02:35 出处:网络
Please help me figure out why the first line does not print the cell text while the second one does: cell.textLabel.text = [NSString stringWithFormat:@\"Hello %@\", [swaItems objectAtIndex:indexPath.

Please help me figure out why the first line does not print the cell text while the second one does:

cell.textLabel.text = [NSString stringWithFormat:@"Hello %@", [swaItems objectAtIndex:indexPath.row]];
cell.t开发者_Go百科extLabel.text = @"Hello";

No error is generated at any time.


Where you want the cell to initialize :

NSArray *swaItems = [[NSArray alloc] initWithObjects:@"1", @"2", @"3", nil];
NSString *string = [swaItems objectAtIndex:indexPath];
NSLog(@"%@", string); 
cell.textLabel.text = string;

Works for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消