iphone - 如何将新数据保存到现有单元格中?

标签 iphone swift core-data swift3 ios10

如何节省现有单元的时间?

第 1 页有姓名、电话号码、公司、职位号码..

因为时间在第2页,我不知道如何方便地保存它。 任何人都可以帮我解决这个问题吗?非常感谢!!!!

NSLocalizedDescription=The operation couldn’t be completed. (Cocoa error 1570.), NSValidationErrorObject=<VisitorMO: 0x60000009c570> (entity: Visitor; id: 0x600000221800 <x-coredata:///Visitor/t47C35BF8-213C-4C00-9B86-DDF5B423B9092> ; data: {
    company = nil;
    jobnumber = nil;
    jobtype = nil;
    name = nil;
    phonenumber = nil;
    signintime = "May 30, 2017, 2:10:23 PM";
})}
)

enter image description here

最佳答案

看起来您想要更新现有单元格的数据..

你可以做一些事情..

首先 yourTableview.reloadData() 调用此方法。

这将重新加载您的桌面 View 。

第二如果您想更新现有单元格..

yourTableview.beginUpdates()
yourTableview.reloadRows(at: [indexPath], with: .automatic)
yourTableview.endUpdates()

这里的indexPath将是您要更新的索引。

第三次更新特定单元格

let indexPathYouWantToUpdate = IndexPath(row:Any row which you want to update,section:0)

let cell = yourTableview.cellForRowAtIndex(at:indexPathYouWantToUpdate) as? YourCustomCell

cell?.value1 = 100
cell?.value2 = 200

按照您想要的方式更新所有单元格值。

我希望这能解决您的问题。

关于iphone - 如何将新数据保存到现有单元格中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44254705/

相关文章:

ios - 是否可以在核心数据提取中添加一个值?

javascript - 我如何修复 :hover on iPhone if there is no <a> element?

iphone - 使用 iPhone 的传感器检测旋转

iphone - 如何使用 CHCSVParser 类

ios - 魔术记录,从UITableView中删除“第0节中的行数无效……”

swift - iOS 8 SDK、Swift、MapKit 绘制路线

iphone - 整合 FlurryAds

ios - Path app如何在注册过程中知道我的电话号码

swift - CocoaPods use_frameworks!原因 "Class X is implemented in both Y and Z"

swift - 安全文本 .echosbullets 不适用于密码字段