UITableView编辑模式删除按钮隐藏在iPhone 4s中

时间:2018-03-19 07:06:48

标签: ios swift uitableview

删除按钮在较小的分辨率下不完全可见。

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    return true
}

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
    if (editingStyle == UITableViewCellEditingStyle.delete) {
    }
}

以下是我的截图

enter image description here

更新1

tableview单元格约束的屏幕截图

enter image description here

1 个答案:

答案 0 :(得分:1)

好的,所以从您的评论中,您的表格视图不会被正确约束到视图。所以你的细胞是"悬挂"离开屏幕的右边缘。

要解决此问题,您应该在故事板中添加约束。

选择表格视图,然后点击添加约束按钮。选择四条边并在框中输入0。

然后点击"添加约束"这应该可以解决你遇到的问题。

添加约束按钮在Interface Builder屏幕的右下角看起来像星球大战战斗机......

enter image description here

相关问题