방금 iOS에서 시작했고 나는 UITableView
으로 붙어 있습니다.sectionForSectionIndexTitle in UITableView iOS
뷰의 오른쪽에 인덱스 바를 구현하고 싶습니다. 나는 이것을 구현했지만 색인 표시 줄의 섹션을 탭하면 작동하지 않습니다.
이것은 내 코드입니다. 여기서 indexArray
은 "A-Z"요소이고 finalArray
은 UITableView
가변 배열입니다.
sectionForSectionIndexTitle
에 구현해야 할 내용을 알려주십시오. 이것은 아마도 예를 고려해야 할 UITableViewDataSource
, 최선을에서 가장 혼란 방법 중 하나입니다
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [finalArray count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection: (NSInteger)section
{
return [finalArray objectAtIndex:section];
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
return indexArray;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle: (NSString *)title atIndex:(NSInteger)index
{
}
아무 것도 반환하지 않으므로 섹션 제목에서 제목을 찾아야 할 수도 있습니다. 이 글을 읽을 : http://stackoverflow.com/questions/2624595/what-exactly-is-the-point-of-tableviewsectionforsectionindextitleatindex를 당신이 그것을 필요가없는 경우이 방법을 삭제합니다. 너는 모두 준비가되어 있어야한다. – Desdenova
감사합니다. 그러나 sectionforsectiontitle을 사용하지 않을 경우. 아무것도하지 않는 것보다 인덱스 바를 탭하십시오. 그래서 이것을 구현해야합니다. 그래서 내가 무엇을 돌려 보내야합니까? 다른 문자를 탭하면 – user1960149