ios - 标 checkout 口无效

标签 ios xcode swift parse-platform xcode6

我想在我的表格原型(prototype)单元格中声明 4 个标签,以便我可以将 Parse 中的所有数据检索到标签中。正如你在图片中看到的,有 4 个标签,我希望每个标签都有自己的 socket ,但它显示无效 socket 错误。 This is the prototype cells and contain 4 labels in it.

我正在使用 Parse 来执行此操作,因此原型(prototype)单元格的父类(super class)将是 PFTableViewCell。

class TimetableViewController: PFQueryTableViewController, UITextFieldDelegate{

    @IBOutlet weak var lblTime: UILabel!

我得到的错误会是这样的...

The lblTime outlet from the TimetableViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

因此,我应该怎么做才能避免这个问题的存在?

最佳答案

您需要创建一个 UITableViewCell 的自定义子类,并在那里声明您的 IBOutlets。然后在整个主视图 Controller 中使用该子类而不是通用 UITableViewCell

重申一下:tableview 单元格内的元素属于单元格,而不属于包含所有内容的 View Controller 。

编辑: 在您的 View Controller 中,您将遵守 UITableView 的委托(delegate)和数据源协议(protocol)(并实现与您要完成的目标相关的任何方法)。您将在以下数据源方法中处理填充(初始)单元格数据:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("cellIdentifier", forIndexPath: indexPath) as! TimetableViewCell
    // TODO: setup cell data here
    return cell
}

关于ios - 标 checkout 口无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30198629/

相关文章:

ios - 为什么 swift 协议(protocol)使用函数重载而不是不同名称的 func ?

iphone - 以 Unity3D 作为子项目的 Xcode 工作区?

iOS 获取最后一帧视频

ios - 有时未收到推送通知

ios - 带虚线的圆圈 uiview

ios - 归档 iOS 项目时找不到文件

Xcode - 在所有文件中搜索文本

ios - 在 iOS 5.1 上的 OpenGL ES 应用程序中,它们真的使用它们声明的顶点数组吗?

ios - 删除对象后重新加载 CollectionViewController?

swift - 我可以使用 Int 从 Swift 设置 Int 枚举类型的 Objective-C 属性吗