Can a UITableViewCell tell when its height changes?

I know I can access self.frame within a UITableViewCell to figure out its height, but I can only do that whenever something else calls a function on the cell. What if the height changes at some other time?


What I want to do is display a circular view within the cell. The only way I know to do this is to set the view layer's cornerRadius property to half the height of the view, and to do that I need to know the height. And if the height changes, I need to update the radius. It would be great if there was a way to express this as a constraint, but if there is I don't know about it.


So I could do this at awakeFromNib or prepareForReuse, and that might work fine in most cases, but is there a general way I can get notified when the cell's height changes? Ideally I'd want to do this totally within the cell and not depend on the data source or delegate to manage it.


Frank

Replies

What about creating a custom view to draw the circle (make it IBDesignable and IBInspectable for convenience).


Then constraint the view to the cell top and bottom.


Did I miss something in your problem ?