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

前端之家收集整理的这篇文章主要介绍了对于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];

注意:

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

希望它对你有用.

原文链接:https://www.f2er.com/iOS/335371.html

猜你在找的iOS相关文章