gpt4 book ai didi

ios - 无法使用 UITableViewDelegate

转载 作者:行者123 更新时间:2023-11-29 02:24:21 25 4
gpt4 key购买 nike

我是 iOS 新手,所以如果这是一个基本问题,请耐心等待。我正在关注 these tutorials在第 43 讲中,这个人删除了现有的 View Controller 并添加了一个新的 View Controller 。然后他插入一个 TableView (来自 Storyboard),命令单击 TableView 并将数据源和委托(delegate)分配给 View Controller 。

然后在 ViewController.swift 文件中添加 UITableViewDelegate ,使其看起来像

import UIKit

class ViewController: UIViewController, UITableViewDelegate{

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}


}

然后他命令点击 UITableViewDelegate 来复制这两个函数:

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!
现在!这些是我面临的问题:

1)当我编写 UITableViewDelegate 时,没有自动完成(这表明有问题)

2)当我命令单击 UITableViewDelegate 时,它​​显示未找到符号(因此我无法获取上述功能)

非常感谢任何帮助。

非常感谢!

最佳答案

尝试进入 XCode 首选项 > 位置 > 然后在“派生数据文本字段”下有一个箭头。单击该按钮。然后删除 DerivedData 文件夹并重新启动 XCode。这可能会修复您的自动完成,因为它由于某种原因不断崩溃。每当自动完成功能对我不起作用时,我只需删除 DerivedData,它通常会再次起作用。

关于ios - 无法使用 UITableViewDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27736211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com