1
UILocalizedIndexedCollation을 사용하여 매우 쉽고 직관적 인 알파벳을 기반으로 섹션 색인을 만드는 방법이 있습니다. 12 시간 시계를 기준으로 섹션 색인을 만드는 방법이 있습니까? "HH : mm a"를 사용하고이를 섹션 헤더로 사용하는 것과 같습니다.섹션이 12 시간 형식으로 색인 됨
Sagos
UILocalizedIndexedCollation을 사용하여 매우 쉽고 직관적 인 알파벳을 기반으로 섹션 색인을 만드는 방법이 있습니다. 12 시간 시계를 기준으로 섹션 색인을 만드는 방법이 있습니까? "HH : mm a"를 사용하고이를 섹션 헤더로 사용하는 것과 같습니다.섹션이 12 시간 형식으로 색인 됨
Sagos
는 sectionIndexTitlesForTableView 구현 : 데이터 소스에서 헤더를 반환합니다.
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
return [NSArray arrayWithObjects:@"12:00 AM", @"01:00 AM", ..., @"11:00 PM", nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 24;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
switch(section) {
case 0: //12:00 AM
...
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
switch(indexPath.section) {
case 0: //12:00 AM
...
}
}
파일을 구문 분석하고 DB에 저장 한 다음 tableview를 만드는 경우 numberOfSections에 정적 번호를 사용할 수 없습니다. 하지만 내 질문에 대한 답변을 주신 것에 대해 감사드립니다. – lifemoveson