@Aurelien Porteの回答に感謝します。これが私の解決策です
この問題の原因:-
- UITableView は、高さが 0.0 のヘッダーを持つことを好みません。高さ0のヘッダーを作成しようとしている場合は、解決策にジャンプできます。
- 後でヘッダーに 0.0 以外の高さを割り当てたとしても、最初は UITableView に高さ 0.0 のヘッダーが割り当てられることを好みません。
ViewDidLoad:-
self.edgesForExtendedLayout = UIRectEdge.None
self.automaticallyAdjustsScrollViewInsets = false
このようなものは必要ありません:-
self.myTableview.contentInset = UIEdgeInsetsMake(-56, 0, 0, 0)
heightForHeaderInSection
デリゲートで: -
if section == 0
{
return 1
}
else
{
return 40; // your other headers height value
}
viewForHeaderInSection
デリゲートで: -
if section == 0
{
// Note CGFloat.min for swift
// For Objective-c CGFLOAT_MIN
let headerView = UIView.init(frame: CGRectMake(0.0, 0.0, self.myShaadiTableview.bounds.size.width, CGFloat.min))
return headerView
}
else
{
// Construct your other headers here
}