gpt4 book ai didi

ios - 重新排序 tableviewcells,右侧白色 "bar"

转载 作者:行者123 更新时间:2023-11-30 12:56:48 26 4
gpt4 key购买 nike

我正在努力解决一个问题,但我似乎找不到解决方案。

为了快速说明问题所在,我添加了一些图像:

这就是我的桌面 View 在添加以纵向模式拍摄的图像时所做的事情:

PortraitImage

正如你所看到的,它在 ImageView 的右侧添加了这个白色条。tableviewcell 中的 ImageView 对边距有限制 - 就像重新排序控件占用了一些 ImageView 无法使用的空间。

奇怪的是,当我添加在横向模式下拍摄的图像时, ImageView 的行为就像我想要的那样 - 正如您在此处看到的:

LangscapeImage

我无法真正弄清楚问题是什么,或者 - 我知道问题是表格 View 处于编辑模式,因为当我将其设置为 false 时,问题就解决了 - 但随后我无法重新排序我的表格 View 细胞:)

这是一些相关代码:

tableView.setEditing(true, 动画: true)

func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return true
}

func tableView(tableView: UITableView, shouldIndentWhileEditingRowAtIndexPath indexPath: NSIndexPath) -> Bool {
return false
}

func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
return UITableViewCellEditingStyle.None
}

我尝试看看是否可以像这样删除 reordercontrol 的 subview :

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
for view in cell.subviews {
print(view.description)
if view.description.containsString("UITableViewCellReorderControl"){
view.removeFromSuperview()
}
}
}

运气不好..它只是删除了重新排序控件(三行),并且白条仍然在那里..

我的 ImageView 的 contentMode 在 Storyboard中设置为 AspectFill。

有什么建议吗? :-)

最佳答案

我通过用 collectionView 交换 tableView 来修复它,然后添加一个手势来重新排序单元格:) 无论如何,谢谢..

关于ios - 重新排序 tableviewcells,右侧白色 "bar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40321156/

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