1
I have an application that returns a json to a tableview, but each time I roll the cells it kind of "chokes", I was told that I would have to leave the return function of the asynchronous json... Someone knows how to handle it on Swift?
There are only 10 lines with image and next to a label, but with tests done, Ih that the problem of slowness is only with the loading of the images that has in the cells in the cellForRowAtIndexPath method if I comment from the line that picks the image url until the end is good, It is as if the Cellforatindexpath method makes every image request at every scroll.
The part of the code you have pro...
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:Cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! Cell
cell.info.text = arrayJson[indexPath.row]
cell.info.font = UIFont.systemFontOfSize(12.0)
if let url = NSURL(string: self.arrayJsonImages[indexPath.row]) {
let data = NSData(contentsOfURL: url)
cell.imagem.contentMode = UIViewContentMode.ScaleAspectFit
cell.imagem.image = UIImage(data: data!)
cell.imagem.layer.masksToBounds = true;
cell.imagem.layer.cornerRadius = 15;
}
return cell
}
Are you populating with a lot of data? Because we usually create a "limitation". Tavelz is this, but details are missing to be sure of your problem.
– Guilherme Nascimento
I’ve already edited the question, I think it’s clearer now...
– JdsMedeirosBR
I’m sorry friend but it’s still hard to understand what "you did" exactly, I recommend you read this: http://answall.com/help/mcve. - I’m sure you’ll take this as constructive criticism :)
– Guilherme Nascimento