对于viewForHeaderInSection中的自定义单元格,重新加载特定的viewForHeaderInSection IOS

我想在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

解决方法

你可以尝试这样的事情:
UIView *headerVw = [YOURTABLEVIEW headerViewForSection:section];
[headerVw setNeedsDisplay];
[headerVw setNeedsLayout];

注意:

>要处理特定视图,您还可以定义标签

希望它对你有用.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...