【发布时间】:2016-01-28 22:15:14
【问题描述】:
我正在尝试用标题和副标题填充单元格。带有字段的标题和带有来自记录的 CreationDate 的详细信息。
我正在尝试以下操作,但我得到了一个无成员“ObjectForKey”
var objects = CKRecord
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let reuseIdentifier = "Cell"
var cell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier) as UITableViewCell?
if (cell != nil) {
cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier)
}
let object = objects[indexPath.row]
cell!.textLabel!.text = object.objectForKey("Notes") as? String
cell!.detailTextLabel?.text = object.creationDate.objectForKey("Notes") as? String
return cell!
}
【问题讨论】:
-
objects数组中有哪些类型的对象?也就是说object是什么类型的对象? -
你为什么要从创建日期获取“Notes”键?
-
var objects = [CKRecord]() 是我的对象。它是来自云套件的数组
标签: ios swift uitableview tableview cloudkit