Skip to content

Commit

Permalink
增加刷新多个section方法
Browse files Browse the repository at this point in the history
  • Loading branch information
gsdios committed Jul 18, 2016
1 parent 21714ba commit 659f3da
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SDAutoLayout.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|

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

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

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

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

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

/**
* 刷新tableView同时调整已经计算好的高度缓存,用于直接将新数据插在旧数据前面的tableView的刷新(用于刷新多个section)
* sectionNumsArray : 要刷新的所有section序号组成的数组, 例@[@(0), @(1)]
* dataCountsArray : 每个section的数据条数组成的数组, 例@[@(20), @(10)]
*/
- (void)reloadDataWithInsertingDataAtTheBeginingOfSections:(NSArray *)sectionNumsArray newDataCounts:(NSArray *)dataCountsArray;

/** 返回所有cell的高度总和 */
- (CGFloat)cellsTotalHeight;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,17 @@ - (void)reloadDataWithInsertingDataAtTheBeginingOfSection:(NSInteger)section new
[self reloadData];
}

- (void)reloadDataWithInsertingDataAtTheBeginingOfSections:(NSArray *)sectionNumsArray newDataCounts:(NSArray *)dataCountsArray
{
self.cellAutoHeightManager.shouldKeepHeightCacheWhenReloadingData = YES;
[sectionNumsArray enumerateObjectsUsingBlock:^(NSNumber *num, NSUInteger idx, BOOL *stop) {
int section = [num intValue];
int dataCountForSection = [dataCountsArray[idx] intValue];
[self.cellAutoHeightManager insertNewDataAtTheBeginingOfSection:section newDataCount:dataCountForSection];
}];
[self reloadData];
}

- (CGFloat)cellsTotalHeight
{
CGFloat h = 0;
Expand Down

0 comments on commit 659f3da

Please sign in to comment.