uitableview sectionTextTitle 滚动显示时可以做点什么。可以参考这个方法
代码来自:CityPickerViewController
https://github.com/guoshimeihua/CityPickerViewController
-
(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
[self showIndexTitle:title];dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self dissmissIndexTitle];
});return [_indexArray[index] integerValue];
} -
(void)showIndexTitle:(NSString *)indexTitle {
self.view.userInteractionEnabled = NO;
self.indexTitleLabel.text = indexTitle;
[self.view addSubview:self.indexTitleLabel];
} -
(void)dissmissIndexTitle {
self.view.userInteractionEnabled = YES;
[self.indexTitleLabel removeFromSuperview];
}
- (void)labelPrepare {
self.indexTitleLabel.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];
self.indexTitleLabel.center = self.view.center;
self.indexTitleLabel.bounds = CGRectMake(0, 0, 120, 120);
self.indexTitleLabel.font = [UIFont boldSystemFontOfSize:80];
self.indexTitleLabel.textAlignment = NSTextAlignmentCenter;
self.indexTitleLabel.textColor = [UIColor whiteColor];
}
网友评论