大佬教程收集整理的这篇文章主要介绍了ios – 在swift中滑动以编辑sqlite数据库内容,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Could not cast value of type 'Table_view.UserTableViewController' (0x10a1991b0) to 'NSIndexPath' (0x10a5e8438).
UserRecordViewController是View Controller,用于显示个人详细信息.而InsertRecordViewController是另一个View Controller.
UserTableViewController相关代码:
func tableView(tableView: UITableView,editActionsForRowATindexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? { // 1 let editAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default,title: "Edit",handler: { (action:UITableViewRowAction,indexPath:NSIndexPath) -> Void in self.performSegueWithIdentifier("editSegue",sender: self) }) editAction.BACkgroundColor = UIColor.darkGrayColor() // let ediTindex = editAction.indexOfAccessibilityElement(indexPath.row) let deleteAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default,title: "delete",indexPath:NSIndexPath) -> Void in let userInfo: UserInfo = self.marrUserData.objectATindex(indexPath.row) as! UserInfo let isdeleted = ModelManager.geTinstance().deleteUserData(userInfo) if isdeleted { Util.invokeAlertMethod("",strBody: "Record deleted successfully.",delegate: nil) } else { Util.invokeAlertMethod("",strBody: "Error in deleting record.",delegate: nil) } self.getUserData() }) deleteAction.BACkgroundColor = UIColor.lightGrayColor() return [deleteAction,editAction] } override func prepareForSegue(segue: UIStoryboardSegue,sender: AnyObject?) { if(segue.identifier == "editSegue"){ let SELEctedIndexPath = sender as! NSIndexPath let index = SELEctedIndexPath.row //if let indexPath: NSIndexPath = self.tableView.indexPathForCell(sender as! UITableViewCell) { //let btnEdit : UIButton = sender as! UIButton //let SELEctedIndex : Int = btnEdit.tag let viewController : InsertRecordViewController = segue.desTinationViewController as! InsertRecordViewController viewController.isEdit = true viewController.userData = self.marrUserData.objectATindex(indeX) as! UserInfo // } } }
我想知道我哪里出错了.伙计们好吗?
提前致谢!!
另一种方法可以在:https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson9.html#//apple_ref/doc/uid/TP40015214-CH9-SW1找到
以上是大佬教程为你收集整理的ios – 在swift中滑动以编辑sqlite数据库内容全部内容,希望文章能够帮你解决ios – 在swift中滑动以编辑sqlite数据库内容所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。