Reputation: 9364
I'm an Android developer, recently started to discover iOS using SWIFT 2
I would like to have a dynamic layout in my custom cell, I have an UImageView. and I have two cases :
To show the image.
To hide the image (OR to remove it) the Cell height should change
I've made my cell height dynamic using :
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 160.0
How Can I achieve that ! here is my code :
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! PostCell
if (posts[indexPath.row].PostImageURL == "None") {
// Remove the Image
} else {
cell.PostImage.load(posts[indexPath.row].PostImageURL!)
}
Upvotes: 0
Views: 49
Reputation: 483
Hope I could help!
Upvotes: 1