K.W. K.W. - 5 months ago 32
iOS Question

UITableView Section with Index

Anything I missed in the following code? I can create a list but the list is array x26 times (26x section) in the

. A list shown, but the section title is only point to 'A'

enter image description here

> An array of A,B,C,D,E.....Z

> An array of a list of people

Thank you.


The datasource method will get called for every section to load, so give the dynamic index of a section as input variable for arr_indexpeople as shown below.

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
  return [arr_indexpeople objectAtIndex:section]