首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用swift5不再工作,xcode无法识别indexPathForSelectedRow

使用swift5不再工作,xcode无法识别indexPathForSelectedRow
EN

Stack Overflow用户
提问于 2022-01-23 11:24:59
回答 1查看 53关注 0票数 0

使用swift5和TableView (没有TableViewController),indexPathForSelectedRow不再被xcode所识别,我不知道发生了什么变化

代码语言:javascript
复制
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        performSegue(withIdentifier: "goToItems", sender: self)
    }
    
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        
        let destinationVC = segue.destination as! ViewController2
        
        if let indexPath = tableView.indexPathForSelectedRow {
            destinationVC.selectedTable = dataTableWord[indexPath.row]
        } else {
            
        }

    }

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-01-23 13:11:23

UITableView对swift5或Xcode没有任何更改。确保正确定义了UITableView变量。或者,如果使用情节提要,请删除tableView插座并将其重新连接到故事板上的UITableView对象。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70821535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档