简体   繁体   中英

Swift Error type 'usersVC' does not conform to protocol 'UITableViewDataSource'

I keep on getting a compiling error on my code. I am not sure whats happening. Please help! I have tried looking all over other forums but nothing is helping me. I am using parse for my project if that matters...

//
//  usersVC.swift
//  CaastRun
//
//  Created by Computer on 5/23/15.
//  Copyright (c) 2015 Caast. All rights reserved.
//

import UIKit

class usersVC: UIViewController, UITableViewDataSource, UITableViewDelegate {


    @IBOutlet weak var resultsTable: UITableView!
    var resultsNameArray = [String]()
    var resultsUserNameArray = [String]()
    var resultsImageFiles = [PFFile]()

    override func viewDidLoad() {
        super.viewDidLoad()


    let theWidth = view.frame.size.width
        let theHeight = view.frame.size.height

        resultsTable.frame = CGRectMake(0, 0, theWidth, theHeight)


    }

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

    func tableview(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return resultsNameArray.count

    }

    func tableview(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 64
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell:usersCell = tableView.dequeueReusableCellWithIdentifier("Cell") as! usersCell

        return cell

    }
}

As mentioned by Martin R, this section of code needs the 'V' in tableView capitalised:

Change this:

   func tableview(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return resultsNameArray.count

    }

To this:

  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return resultsNameArray.count

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM