2017-12-04 19 views
0
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 
    let height = self.navigationController?.navigationBar.frame.size.height 
    return view.frame.size.height - height! 
} 

セルサイズを変更したい - 私は1つのセルしか使用しません。UITableViewでセルの高さを設定するには?

私の目的は画面にフィットすることです。しかし、私の場合、セルはスクロールされます。

安全領域を計算する必要があると思います。画面のサイズを小さくしたり大きくしたりしないとどうなりますか?

答えて

0

安全な市外局番を含む高さは、以下のように計算してください。

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 
    let height = view.bounds.height - view.safeAreaInsets.top - view.safeAreaInsets.bottom 
    return height! 
} 
+0

Good!それが私が望んだことです。ありがとうございました – usinuniverse

関連する問題