簡體   English   中英

為什么表格視圖的尺寸與iPhone X〜iPhone XS Max不同?

[英]Why is the table view different size from iPhone X~iPhone XS Max?

在情節提要中,我以全尺寸填充表格視圖。


我將占位符視圖高度設置為這樣。

self.placeholderView.frame.size.height = self.mainTableView.frame.height


如果我啟動iPhone se〜iPhone 8 Plus,效果很好。



但是,如果我推出iPhone X〜iPhone Xs Max,則體積很小。

即使在iPhone X的情況下,表格視圖本身也是完整尺寸。 但是,為什么我在獲得表格視圖時會得到不同的大小?
如何解決?

您應該改用這個

self.table.backgroundView = yourView()

如果您想將數據設置回表中,只需設置

if table.backgroundView != nil{
   table.backgroundView = nil
}

我不知道您是否喜歡這個想法,但是每次將背景表格視圖更改為顯示無數據或沒有互聯網連接的用戶時,我都會使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM