Swift iOS
xcode 7.1 Beta
I am trying to set background image on the PFQueryTableViewController
. I tried dragging the table from the story board (Ref. outlet: tableView) but I am not able to make the code work referring to that outlet.
let image = UIImage(named: "Background")
tableView.backgroundView = UIImageView(image: image)
The app crashes stating:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
.
I even tried setting the background color tableView.backgroundColor = UIColor.greenColor()
But again, the app crashes
Can someone explain what's going on in here? I searched online, but most of the posts are only related to fetching images inside the PFQueryTableViewController cell.
Try using the same code inside the queryForTable() block that returns query. It should work. No need of reference outlet.
Code should be something like:
override func queryForTable() -> PFQuery {
let image = UIImage(named: "YourImageName")
tableView.backgroundView = UIImageView(image: image)
// your PFQueryTableViewController query goes here....
return query
}