gpt4 book ai didi

ios - 在tableView中commitEditingStyle时,imageView高度出现大溢出?

转载 作者:行者123 更新时间:2023-11-30 13:31:59 25 4
gpt4 key购买 nike

我发现在tableView中向左滑动commitEditingStyle,包括imageView有点下降(溢出),我的错在哪里?我添加了一些有关我所做的事情的信息。

使用自动布局0到每一侧 super View :

enter image description here

viewDidLoad中设置tableView rowHeight:

override func viewDidLoad() {
super.viewDidLoad()

// deleting top tableView spacing..
tableView.contentInset = UIEdgeInsetsZero
self.automaticallyAdjustsScrollViewInsets = false

// set rowHeight
tableView.rowHeight = (self.view.frame.height - self.navigationController!.navigationBar.frame.size.height - 20) / 4

tableView.delegate = self
tableView.dataSource = self

}

这是我的 tableViewcommitEditingStyle 函数:

func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {

if editingStyle == .Delete {
let city = cities[indexPath.row]
ad.managedObjectContext.deleteObject(city)
do {
try ad.managedObjectContext.save()
}
catch {
fatalError("Error deleting item!")
}

fetchAndSetResults()

} else if editingStyle == .Insert {
// ..
}
}

enter image description here

最佳答案

如果您有“长宽比填充”模式,只需将“剪辑 subview ”添加到单元格中的 ImageView 中即可。

关于ios - 在tableView中commitEditingStyle时,imageView高度出现大溢出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36481899/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com