ios - I am facing this error " this class is not key value coding-compliant for the key tableView" . What am I doing wrong over here? -
this question has answer here:
so, multi page application , whenever switch page uitable present in face error " setvalue:forundefinedkey:]: class not key value coding-compliant key tableview." got same error before cause forgot add numberofrowsinsection function after adding still facing same error.
class workingquery: uiviewcontroller, uitableviewdelegate, uitableviewdatasource{ @iboutlet weak var tableviews: uitableview! override func viewdidload() { super.viewdidload() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated } //tableview code var names = ["mark", "cloyd", "buck", "steve", "wallace"] var breeds = ["labrador retriver", "bulldog", "german shepherd", "golden retriver", "yorkshire"] var images = [uiimage(named:"johnny"), uiimage(named:"dusra"), uiimage(named:"third"), uiimage(named:"fourth"), uiimage(named:"fifth")] func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return 5 } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = self.tableviews.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! customcell cell.photo.image = images[indexpath.row] cell.fullname.text = names[indexpath.row] cell.agesex.text = breeds[indexpath.row] return cell } }
open storyboard (or xib) , click on "file's owner".
select: view -> utilities -> show connections inspector
you'll see 1 connection exclamation mark:
click on x remove connection, build & run.
Comments
Post a Comment