Anything I missed in the following code? I can create a list but the list is array x26 times (26x section) in the UITableView
. A list shown, but the section title is only point to 'A'
arr_indexpeople
> An array of A,B,C,D,E.....Z
arr_completeArray
> An array of a list of people
Thank you.
返回[arr_indexpeople objectAtIndex:section]
You are returning objectAtIndex 0 in titleForHeaderInSection. Change it to-
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return [arr_indexpeople objectAtIndex:section]
}
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]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.