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()
}
Istnieje różnica w wysokości 200-400 w każdej komórce, więc próbowali realizacji obliczeń wysokość w estimatedHeightForRowAtIndexPath
.I przechyłki dokładnej wysokości kosztorysowej w tej metodzie jako bcz obliczeńUITableView kwestie przewijanie samo komórka zaklejania z dużej różnicy wysokości komórek
i buforowanie wysokości w metodzie willDisplayCell
, ale nadal przeskakiwanie przebiega tak, jak jest to czasochłonne renderowanie.
Komórka jest jak Facebooku kart układ typu z dużą ilością dynamicznych danych o zmiennej wysokości tekstu i images.Can ktoś może mi pomóc w tej .Dzięki
Czy możesz mi powiedzieć więcej o tym, jak obliczyć wysokość komórki w 'Tableview (_ : estimatedHeightForRowAtIndexPath:) '? –