![](/img/trans.png)
[英]error : type “UserAccView” does not conform to protocol 'UITableViewDataSource'
[英]Swift Error type 'usersVC' does not conform to protocol 'UITableViewDataSource'
我一直在代码中遇到编译错误。 我不确定发生了什么。 请帮忙! 我尝试遍及其他论坛,但没有任何帮助。 如果这很重要,我正在为我的项目使用解析...
//
// 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
}
}
正如Martin R所提到的,此部分代码需要在tableView中使用大写的“ V”:
更改此:
func tableview(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return resultsNameArray.count
}
对此:
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return resultsNameArray.count
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.