1、項目中纽竣,tableviewcell采用自適應(yīng)高度墓贿,利用stackview動態(tài)改變每一行cell的高度,cell中自定義button蜓氨,點擊可將cell展開和折疊募壕,這時調(diào)用了
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
方法,刷新當(dāng)前cell的數(shù)據(jù)语盈,改變高度。
cell中的圖片出現(xiàn)閃動的現(xiàn)象缰泡,因為采用的是動態(tài)改變高度刀荒,在數(shù)據(jù)模型中并未根據(jù)內(nèi)容計算cellHeight,所以出現(xiàn)刷新閃的現(xiàn)象,添加如下代碼后棘钞,cell正常顯示
//視圖轉(zhuǎn)換時不執(zhí)行動畫缠借,參數(shù)為block對象,來執(zhí)行你要執(zhí)行的代碼
+ (void)performWithoutAnimation:(void (^)(void))actionsWithoutAnimation
官方解釋為
actionsWithoutAnimation
The view transition code that you want to perform without animation.
在沒有動畫的情況下執(zhí)行的視圖過渡代碼宜猜。
[UIView performWithoutAnimation:^{
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}];
禁止隱式動畫泼返,頁面不再閃