简体   繁体   English

Swift错误类型'usersVC'不符合协议'UITableViewDataSource'

[英]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: 正如Martin R所提到的,此部分代码需要在tableView中使用大写的“ V”:

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

    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:类型“ UserAccView”不符合协议“ UITableViewDataSource” - error : type “UserAccView” does not conform to protocol 'UITableViewDataSource' Xcode类型“ ViewController”中出现错误不符合协议“ UITableViewDataSource” - Getting error in Xcode type “ViewController” does not conform to protocol“UITableViewDataSource” 与“类型'ViewController'不符合协议'UITableViewDataSource'”相关的编译和构建错误 - Compile & Build error related to “Type 'ViewController' does not conform to protocol 'UITableViewDataSource'” 类型的viewcontroller不符合协议uitableviewdatasource - type viewcontroller does not conform to protocol uitableviewdatasource 类型TypeViewOne不符合协议UITableViewDataSource - type TypeViewOne does not conform to protocol UITableViewDataSource 类型“ ViewController”不符合协议“ UITableViewDataSource” - Type “ViewController” does not conform to protocol 'UITableViewDataSource" 类型“ViewController”不符合协议“UITableViewDataSource” - Type 'ViewController' does not conform to protocol 'UITableViewDataSource' 类型“ ViewController”不符合协议“ UITableViewDataSource” - Type'ViewController' does not conform to protocol 'UITableViewDataSource' 类型“ ViewController”不符合协议“ UITableViewDataSource” - Type 'ViewController' does not conform to protocol 'UITableViewDataSource' UITableView不符合协议UITableViewDataSource错误 - UITableView does not conform to protocol UITableViewDataSource error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM