0

I'm wondering how to set a cell's detail text using an NSArray similar to

tableData = [NSArray arrayWithObjects:@"Example", @"Example2", nil];

I'm not sure if it's possible but surely this awesome community could find something :D

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
Colton Anglin
  • 431
  • 3
  • 9
  • 19

1 Answers1

0

Obviously you need a string to set the text. So you need to create a string from your array. A quick scan of the docs for NSArray reveals a handy method named componentsJoinedByString:.

NSArray *myArray = @[ ... ];
NSString *arrayText = [myArray componentsJoinedByString:@", "];
cell.detailTextLabel.text = arrayText;
rmaddy
  • 314,917
  • 42
  • 532
  • 579