Reputation: 1
I have difficulty in writing code, an error in the protocol, I use xcode 7.3.1
//2 Method dari protokol UITableViewDataSource->method 1.
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//Return the numberofRowsInSection.
return namaRestoran.count
}
//Method 2.
func tableView(tableView: UITableView, cellForRowAtIndextPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as UITableViewCell
//Configurasi the Cell.
cell.textLabel?.text = namaRestoran[indexPath.row]
return cell
}
Upvotes: 0
Views: 635
Reputation: 777
It looks like you have spelled tableView(tableView: UITableView, cellForRowAtIndextPath indexPath: NSIndexPath) -> UITableViewCell
incorrectly.
It should be tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
Upvotes: 2
Reputation: 89
You must implement the function:
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1; // Or any other number
}
Upvotes: 0