UITableViewCell中的ImageView将不会显示

罗格·休伊斯曼斯(Rutger Huijsmans)

我已经将ImageView放在Storyboard的UITableViewCell中,但在运行时它并未显示在模拟器上。我该如何解决?

我的故事板:

我的情节提要的图像 我的情节提要的对象概述:

在此处输入图片说明 填充单元格的Swift代码:

func tableView(gamesListTableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var cell = gamesListTableView.dequeueReusableCellWithIdentifier("Game", forIndexPath: indexPath) as! UITableViewCell
    if (indexPath.row < GamesList.count) {
        cell.detailTextLabel?.text = GamesList[indexPath.row]["game_guid"].string!;
        cell.textLabel?.text = GamesList[indexPath.row]["opponent_name"].string!;
        if (GamesList[indexPath.row]["self_turn"] == false) {
            cell.textLabel?.textColor = UIColor.greenColor();
        } else if (GamesList[indexPath.row]["game_idle_time"] <= 60) {
            cell.textLabel?.textColor = UIColor.yellowColor();
        } else {
            cell.textLabel?.textColor = UIColor.redColor();
        }
    } else {
        cell.detailTextLabel?.text = InvitesList[indexPath.row - GamesList.count]["invite_guid"].string!;
        cell.textLabel?.text = InvitesList[indexPath.row - GamesList.count]["invite_text"].string!;
        cell.textLabel?.textColor = UIColor.blueColor();
    }
    return cell
}

它在运行时看起来是什么样的:

在此处输入图片说明

编码艺术

您可能应该暂停执行并在Xcode中查看视图层次结构。在运行时检查它的帧大小,看看是否有A.)东西重叠或B.)如果约束错误。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章