ios - TableViewCell 未完全显示
问题描述
我的 TableViewCells 在 Xcode 中看起来很正常,但在模拟器中显示时会被截断。请看下面的图片。
有谁知道这是为什么?
任何帮助深表感谢!
Xcode 图片:
模拟器图像:
class Feed: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.shared.isStatusBarHidden = false
}
override open func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
//It will hide the status bar again after dismiss
UIApplication.shared.isStatusBarHidden = false
}
override open var prefersStatusBarHidden: Bool {
return false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 1
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! FeedCell
// Configure the cell...
return cell
}
解决方案
使用tableView(_:heightForRowAt:)
. 根据要求添加高度。
推荐阅读
- database - 是否有文本编辑器、编辑器插件或 NLP 算法可以解连接一串单词,中间没有空格
- mysql - Amazon Aurora 是否为在从节点上运行的只读事务提供可序列化隔离?
- django - 了解 django 中的关系
- java - 使用带有基本连接脚本的 Oracle Jar (ojdbc7.jar)
- swift - 无法在 Double 中转换和使用字符串值 - Swift
- c# - 将字符串格式的python字节转换为c#中的字节数组
- php - 加载 XML 数据而不刷新
- javascript - javascript:刷新预先删除的 id 参数 URL 使页面崩溃
- javascript - 使用目标 href 参数制作了一个函数
- sql-server - SAP 功能模块到 SQL Server 存储过程