1.使用上拉加載,會反復調用回調方法
問題描述:如果從服務器請求到的數據為空,調用[tableview.footer endrefresh]方法,就會反復多次的調用回調方法
出現問題的原因:上拉的主要問題的原因是 tableViews :在iOS 11中默認啟用Self-Sizing
解決方法:
if (@available(iOS 11.0, *)) {
? ?// ? ? _couponListTabV.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
? ? ? ? _couponListTabV.estimatedRowHeight =0;
? ? ? ? _couponListTabV.estimatedSectionHeaderHeight =0;
? ? ? ? _couponListTabV.estimatedSectionFooterHeight =0;
? ? }
擴展:頭部刷新UI出現了錯亂
解決辦法:?
if (@available(iOS 11.0, *)) {
? ? ? ? _couponListTabV.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
注釋:
iOS 11 中scrollView會自動計算和適應頂部和底部的內邊距并且在scrollView 不可滾動時,也會設置內邊距.
-scrollableAxes 自動計算內邊距.
-never不計算內邊距
-always 根據safeAreaInsets 計算內邊距