【问题标题】:For custom cell in viewForHeaderInSection reload particular viewForHeaderInSection IOS对于 viewForHeaderInSection 中的自定义单元重新加载特定 viewForHeaderInSection IOS
【发布时间】:2015-10-19 23:25:37
【问题描述】:

我想重新加载 viewForHeaderInSection,以防 viewForHeaderInSection 中的自定义单元格重新加载特定 viewForHeaderInSection IOS。

我使用了以下代码

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation: UITableViewRowAnimationAutomatic];

但整个部分会重新加载

我也尝试了以下方法通过创建自定义视图

SearchHeaderView 是自定义视图

  - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

            lblPrice_Header.text = [NSString stringWithFormat:@"%d",cartSum] ;
            return SearchHeaderView;

        }

 -(void)cartSum :(id)sender{
   .....
   .......
    =======================================
     cartSum =cartSum+[[subArray objectAtIndex:j]  intValue]*price;

        UIView *headerVw = [self.tableView headerViewForSection:section];
        [headerVw setNeedsDisplay];
        [headerVw setNeedsLayout];

    }

但它不会重新加载该部分。

我的部分标题如下

我已经检查了以下链接

Reloading tableView header in ios7

Changing UITableView's section header/footer title without reloading the whole table view

【问题讨论】:

标签: ios objective-c uitableview


【解决方案1】:

你可以试试这样的:

UIView *headerVw = [YOURTABLEVIEW headerViewForSection:section];
[headerVw setNeedsDisplay];
[headerVw setNeedsLayout];

注意:

  • 要处理特定视图,您也可以定义标签

希望它对你有用。

【讨论】:

    猜你喜欢
    • 2015-11-19
    • 2013-10-18
    • 1970-01-01
    • 2015-02-20
    • 1970-01-01
    • 2015-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多