Linked Questions

Popular Questions

UITableViewCell detail text label improper layout

Asked by At

I have UITableViewCell subclass that insets the content view. When the content view is inset the text label is okay but the detail text label becomes out of frame and has does not adjust itself to the new content view frame.

Screen shot of cell

I have tried calling setNeedsLayout to tell the layout engine to adjust the layout of all the subviews but issue has still persisted. Below is the code to inset the content view in my UITableViewCell subclass

 override func layoutSubviews() {
    super.layoutSubviews()
    contentView.frame = contentView.frame.inset(by: UIEdgeInsets.custom)
    contentView.layer.cornerRadius = CornerRadius.defaultRadius
}

enum CornerRadius {
    static let defaultRadius: CGFloat = 10
}

Related Questions