ios – Swift尝试将表视图单元格上的点击事件链接到控制器方法
发布时间:2020-12-15 01:54:30 所属栏目:百科 来源:网络整理
导读:我是新来的,并且没有在客观C中编程。所以我是新的:-) 试图做一些相当简单的事情。链接表视图单元格单击以调用控件中的方法,如此 http://prntscr.com/4m9kf7 编辑: 我在MasterController中有这些方法 override func tableView(tableView: UITableView,numb
我是新来的,并且没有在客观C中编程。所以我是新的:-)
试图做一些相当简单的事情。链接表视图单元格单击以调用控件中的方法,如此 http://prntscr.com/4m9kf7 编辑: 我在MasterController中有这些方法 override func tableView(tableView: UITableView,numberOfRowsInSection section: Int) -> Int { override func tableView(tableView: UITableView,cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { override func tableView(tableView: UITableView,canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { override func tableView(tableView: UITableView,commitEditingStyle editingStyle: UITableViewCellEditingStyle,forRowAtIndexPath indexPath: NSIndexPath) { override func tableView(tableView: UITableView!,didSelectRowAtIndexPath indexPath: NSIndexPath!) { 我已经在所有4个中添加了断点。 http://prntscr.com/4m9ql0 解决方法
您需要实现didSelectRowAtIndexPath委托方法并将其中的处理代码放在其中。
override func tableView(tableView: UITableView,didSelectRowAtIndexPath indexPath: NSIndexPath) { //CODE TO BE RUN ON CELL TOUCH } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |