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