I am loading items from a web service into a UITableView in an iOS app. The problem here is that as soon as the data is loaded, the number of lines that are visible from above without scrolling becomes invisible. The page is blank. If I scroll down, the images below load fine. When scrolling up again, images also load correctly.
Detailed screenshot link: https://www.dropbox.com/sh/nfxcgw2ple8g4mt/AAAOTswWDEN-s2-dAbJ1bHu7a?dl=0
class FirstViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{
override func viewDidLoad() {
super.viewDidLoad()[1]
query.readWithCompletion({ (result , error) -> Void in
if (error == nil)
{
self.activityIndicatorView.hidden = true
self.allResults = result.items
println( self.allResults!.count )
self.tableView.hidden = false
self.tableView.reloadData()
}
else{
println(error.localizedDescription)
}
})
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
if (allResults != nil) { return self.allResults.count }
else { return 0 }
}
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
{ return 200 }
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
var cell: CellClass = self.tableView.dequeueReusableCellWithIdentifier("item") as! CellClass
return cell
}
source
share