import UIKit
class SecondViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
@IBOutlet var search: UISearchBar!
@IBOutlet var Tableview: UIView!
var items = ["hello"]
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.
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var cell: Tableview.deqeueReusableCellWithIdentifier;("cell")
//Error = Undeclared type 'Tableview'
cell.textLabel?.text = self.items[indexPath.row]
return cell;
}
}
答案 0 :(得分:2)
用等号替换冒号(rand.nextInt(3);
),你就可以了:
:
另一方面,即使Xcode不会给你一个错误,你也不应该用资本开始你的变量。惯例是,起始大写应该是表示类名。