agf*_*105 5 core-data uitableview swift
我在将一些值保存到我的coredata数据库后尝试填充我的tableview.我要求它显示我的代码中指示的一些值,但无论我做什么,我都会收到上述错误.有什么建议?我已尝试过其他一些有这个问题的帖子,但似乎没什么用.
我想不出我可能会给出一个零输出Swift没有预料到的地方.
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell? {
let CellId: NSString = "Cell"
var cell: UITableViewCell = tableView?.dequeueReusableCellWithIdentifier(CellId) as UITableViewCell
if let ip = indexPath {
var data: NSManagedObject = myCustomers[ip.row] as NSManagedObject
var addno = data.valueForKeyPath("custaddno") as String
var addname = data.valueForKeyPath("custaddfirstline") as String
cell.textLabel.text = "\(addno) \(addname)"
var jcost = data.valueForKeyPath("custjobcost") as Float
var jfq = data.valueForKeyPath("custjobfq") as Float
var jfqtype = data.valueForKeyPath("custjobfqtype") as String
cell.detailTextLabel.text = "Charge: \(jcost) to be done every \(jfq) \(jfqtype)"
}
return cell
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1897 次 |
| 最近记录: |