//排列数组
- (NSMutableArray *)sortArray:(NSArray *)array{
NSMutableArray *sortArray = [NSMutableArray array];
for (ZBHomeDoctorChat *entity in array) {
[sortArray insertObject:entity atIndex:0];
}
NSMutableArray *mArray = [NSMutableArray arrayWithArray:array];
[mArray sortUsingComparator:^NSComparisonResult(ZBHomeDoctorChat *entity1, ZBHomeDoctorChat *entity2)
{
if ([entity1.dialog_timestamp integerValue] > [entity2.dialog_timestamp integerValue])
{
return NSOrderedDescending;
}
else
{
return NSOrderedAscending;
}
}];
//增加根据数组计算单个cell高度,计算完成后刷新tableview,保存对应cell高度,return时取出高度使用,数组数量增加时,高度dic需要相应调整indexPath,避免重新计算已有高度
return mArray;
}
网友评论