-4
**哪里出错?ViewController不符合协议'UITableViewDataSource
ERROR “SecondViewController不符合协议“UITableViewDataSource” **
进口的UIKit
类SecondViewController:UIViewController中,UITableViewDataSource,的UITableViewDelegate
{
@IBOutlet weak var tableView: UITableView!
var videos:[video] = [video]()
@IBOutlet weak var menuButton: UIBarButtonItem!
override func viewDidLoad() {
super.viewDidLoad()
if self.revealViewController() != nil {
menuButton.target = self.revealViewController()
menuButton.action = #selector(SWRevealViewController.revealToggle(_:))
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
let model = videoModel()
self.videos = videoModel().getVideos()
self.tableView.dataSource = self
self.tableView.delegate = self
}
func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return videos.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "BasicCell", for: indexPath)
let videoTitle = videos[indexPath.row].videoTitle
//customize the cell
cell.textLabel?.text = videoTitle
return cell
}
}
}
请不要将您的代码作为图像发布。将实际的相关代码复制并粘贴到您的问题中。 – rmaddy