func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
let json = JSON(data: activityTableView.onlineFeedsData)[indexPath.row] // new
if(json["topic"]["reply_count"].int > 0){
if let cell: FeedQuestionAnswerTableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier_reply) as? FeedQuestionAnswerTableViewCell{
cell.selectionStyle = .None
cell.tag = indexPath.row
cell.relatedTableView = self.activityTableView
cell.configureFeedWithReplyCell(cell, indexPath: indexPath, rect: view.frame,key: "activityTableView")
// Make sure the constraints have been added to this cell, since it may have just been created from scratch
cell.layer.shouldRasterize = true
cell.layer.rasterizationScale = UIScreen.mainScreen().scale
return cell
}
}else{
if let cell: FeedQuestionTableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as? FeedQuestionTableViewCell{
cell.selectionStyle = .None
cell.tag = indexPath.row
cell.relatedTableView = self.activityTableView
cell.configureFeedCell(cell, indexPath: indexPath, rect: view.frame)
// Make sure the constraints have been added to this cell, since it may have just been created from scratch
cell.layer.shouldRasterize = true
cell.layer.rasterizationScale = UIScreen.mainScreen().scale
return cell
}
}
return UITableViewCell()
}
esiste una differenza di 200-400 in altezza in ogni cella, quindi provato che attua il calcolo altezza in estimatedHeightForRowAtIndexPath
.I sopraelevazione l'altezza esatta stima in questo metodo come bcz di calcoloUITableView problemi di scorrimento sé cella dimensionamento con grande differenza di altezza della cella
e il caching dell'altezza nel metodo willDisplayCell
ma continua a scorrere come se ci fosse bisogno di tempo per il rendering.
La cellula è come la carta layout di tipo Facebook con un sacco di dati dinamici con testo di altezza variabile e images.Can qualcuno mi aiuti in questo .grazie
mi puoi dire qualcosa di più su come calcolare l'altezza della cella in 'tableView (_ : estimatedHeightForRowAtIndexPath:) '? –