Skip to content

Commit 659f3da

Browse files
committed
增加刷新多个section方法
1 parent 21714ba commit 659f3da

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

SDAutoLayout.podspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Pod::Spec.new do |s|
22

33
s.name = "SDAutoLayout"
4-
s.version = "2.1.2"
5-
s.summary = "The most easy way for autoLayout. 2.1.2版本更新内容:增加设置偏移量offset功能;修复用xib生成的view出现的部分约束失效问题;修复其他bug"
4+
s.version = "2.1.3"
5+
s.summary = "The most easy way for autoLayout. 2.1.3版本更新内容:增加设置偏移量offset功能;修复用xib生成的view出现的部分约束失效问题;修复其他bug"
66

77
s.homepage = "https://github.com/gsdios/SDAutoLayout"
88
# s.screenshots = "https://camo.githubusercontent.com/5d9e879c7006297b3d6e12c20c6cd1e15bf83016/687474703a2f2f7777332e73696e61696d672e636e2f626d6964646c652f39623831343665646777316578346d756b69787236673230396730376c6864742e676966"
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.platform = :ios
1515
s.platform = :ios, "7.0"
1616

17-
s.source = { :git => "https://github.com/gsdios/SDAutoLayout.git", :tag => "2.1.2"}
17+
s.source = { :git => "https://github.com/gsdios/SDAutoLayout.git", :tag => "2.1.3"}
1818

1919
s.source_files = "SDAutoLayoutDemo/SDAutoLayout/**/*.{h,m}"
2020

SDAutoLayoutDemo/SDAutoLayout/UITableView+SDAutoTableViewCellHeight.h

+7
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ typedef void (^AutoCellHeightDataSettingBlock)(UITableViewCell *cell);
7070
/** 刷新tableView同时调整已经计算好的高度缓存,用于直接将新数据插在旧数据前面的tableView的刷新 */
7171
- (void)reloadDataWithInsertingDataAtTheBeginingOfSection:(NSInteger)section newDataCount:(NSInteger)count;
7272

73+
/**
74+
* 刷新tableView同时调整已经计算好的高度缓存,用于直接将新数据插在旧数据前面的tableView的刷新(用于刷新多个section)
75+
* sectionNumsArray : 要刷新的所有section序号组成的数组, 例@[@(0), @(1)]
76+
* dataCountsArray : 每个section的数据条数组成的数组, 例@[@(20), @(10)]
77+
*/
78+
- (void)reloadDataWithInsertingDataAtTheBeginingOfSections:(NSArray *)sectionNumsArray newDataCounts:(NSArray *)dataCountsArray;
79+
7380
/** 返回所有cell的高度总和 */
7481
- (CGFloat)cellsTotalHeight;
7582

SDAutoLayoutDemo/SDAutoLayout/UITableView+SDAutoTableViewCellHeight.m

+11
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,17 @@ - (void)reloadDataWithInsertingDataAtTheBeginingOfSection:(NSInteger)section new
392392
[self reloadData];
393393
}
394394

395+
- (void)reloadDataWithInsertingDataAtTheBeginingOfSections:(NSArray *)sectionNumsArray newDataCounts:(NSArray *)dataCountsArray
396+
{
397+
self.cellAutoHeightManager.shouldKeepHeightCacheWhenReloadingData = YES;
398+
[sectionNumsArray enumerateObjectsUsingBlock:^(NSNumber *num, NSUInteger idx, BOOL *stop) {
399+
int section = [num intValue];
400+
int dataCountForSection = [dataCountsArray[idx] intValue];
401+
[self.cellAutoHeightManager insertNewDataAtTheBeginingOfSection:section newDataCount:dataCountForSection];
402+
}];
403+
[self reloadData];
404+
}
405+
395406
- (CGFloat)cellsTotalHeight
396407
{
397408
CGFloat h = 0;

0 commit comments

Comments
 (0)