开发者

Redraw or Reset table view header and/or footer

开发者 https://www.devze.com 2023-01-11 01:15 出处:网络
Is there a way other than [tableView re开发者_运维问答loadData] to refresh table header and/or footer? With respect to both:

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";
}
0

精彩评论

暂无评论...
验证码 换一张
取 消