I am trying to show a comment on an app like in the following pictures. I'm using Xcode 9.4.1.
I use the following code to hide the label:
if commentManager == nil {
cell.managerReplyLabel.isHidden = true
cell.ratingManagerLabel.isHidden = true
}
But it looks still like it has a space on it which I hidden two labels.
I try to use cell.ratingManagerLabel.font.withSize(0)
or
cell.ratingManagerLabel.frame.size.height = 0
to change the label hight, but it doesn't work.
How to reduce the space?
Update:
I use storyboard to set the screen and auto-layout.
import UIKit
import Cosmos
class RatingTableViewCell: UITableViewCell {
@IBOutlet weak var userNameLabel: UILabel!
@IBOutlet weak var ratingStar: CosmosView!
@IBOutlet weak var ratingUserLabel: UILabel!
@IBOutlet weak var ratingManagerLabel: UILabel!
@IBOutlet weak var managerReplyLabel: UILabel!
}
Use the delegate method in your UITableView Class.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
return 200 //or whatever you need
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With