Redraw or Reset table view header and/or footer
Is there a way other than [tableView re开发者_运维问答loadData]
to refresh table header and/or footer? With respect to both:
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;
OR
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section;
For example, I'm showing a small summary in the footer. When the data in the row changes, the affect should be reflected in the footer as well.
Create a UILabel and set it as section header/footer. Update the UILabel whenever you want.
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return sectionFooterView;
}
- (void)viewDidLoad {
// create sectionFooterView in Interface Builder, change the frame here
// use Font-size:15 , BG-Color: clearColor , text-Color: RGB=(97,105,118)
// and Text-alignment:Center to look like table view's original footer
sectionFooterView.frame = CGRectMake(0, 10, 320, 12);
}
- (void)changeFooter {
sectionFooterView.text = @"Footer";
}
精彩评论