我正在创建一个cloudkit tableview.我加载应用程序,我的tableview显示我的云套件条目.
然后我使用我的add方法insertNewObject将记录添加到云套件中,但这不会显示在我的tableview中.它只会出现在我下次运行的应用程序中.
func insertNewObject(sender: AnyObject) {
let record = CKRecord(recordType: "CloudNote")
record.setObject("New Note", forKey: "Notes")
MyClipManager.SaveMethod(Database!, myRecord:record)
dispatch_async(dispatch_get_main_queue()) {
self.tableView.reloadData()
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的添加方法.我正在调用tableview重载,你可以看到,但什么也没发生.
我的tableview创建代码:
// Tableview stuff --- Done
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
/////// Get number of rows
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return objects.count
}
//// FIll the table
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) …Run Code Online (Sandbox Code Playgroud) 对于您的专家来说,这可能是一个简单的问题,但我无法找出正确的解决方案.
在我的应用程序中,我创建了一个表视图来列出一个项目.
在单元格的第一行有一个switch(ON/OFF).
因此我的客户端需要在切换时隐藏底部单元格(除了第零个单元格)并在切换时OFF显示所有单元格ON.
我通过代码创建了切换.
任何人都可以帮我解决这个问题吗?
提前致谢.