Swift UIImageView 未在设备上显示

Swift UIImageView not shown on device

我正在使用以下代码在 textFieldDidEndEditing 中显示 UIImageView:

let indexPath = IndexPath(row: 0, section: 0)
let cell = tableViewBodydata.cellForRow(at: indexPath) as! tvcell_Logbook
cell.imageViewArrow.isHidden = false
cell.imageViewArrow.image = UIImage(named: "same.png")

该代码在 iPhone X 模拟器上运行完美。但是,如果我在我的 iPhone X 设备上测试它,则不会显示 imageView。该函数被正确调用,我调试了它,但没有任何反应。我重新安装了几次应用程序并重新启动了设备,但没有任何改变。有人可以帮我吗?

编辑 1

我在 cellForRow 中使用此代码:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    var cell: tvcell_Logbook!

    if indexPath.row == 0 {

        cell = tableView.dequeueReusableCell(withIdentifier: "CellWeight", for: indexPath) as! tvcell_Logbook
        cell.imageViewArrow.isHidden = false
        cell.imageViewArrow.image = UIImage(named: "same.png")
    }

    ...

    return cell }

以及 textFieldDidEndEditing 中的这段代码:

func textFieldDidEndEditing(_ textField: UITextField) {

let indexPath = IndexPath(row: 0, section: 0)
let cell = tableViewBodydata.cellForRow(at: indexPath) as! tvcell_Logbook
cell.imageViewArrow.isHidden = false
cell.imageViewArrow.image = UIImage(named: "same.png") }                

如果您的文件名是 Same.png:

UIImage(named: "Same.png")

你的图片在文件系统中是如何命名的?