MikeJ
MikeJ

Reputation: 552

The state of a custom UITableViewCell after the Delete control has been dismissed

I've created a custom UITableViewCell that provides a single custom UIView for its contentView. The custom UIView uses CoreText so that I can display bibliographic data with book titles or journal titles in italics. The table displays correctly, and the text is adjusted if you swipe the row. However, if you dismiss the control, the adjusted text is just expanded to fill the space and appears bloated. I can see that drawRect is called in the content view when the cell is first displayed and when the control appears. However, it is not called when the control is dismissed.

How should I be handling the dismissal of the delete control? Should I be asking for the cell to be redrawn at some specific point in the lifecycle?

The table with custom cells:

The table view with custom cells

Table cell with the control:

Custom table cell with a delete control

Table cell after the delete control has been dismissed:

Custom table cell after the delete control has been dismissed

Upvotes: 1

Views: 261

Answers (1)

jrturton
jrturton

Reputation: 119292

Try setting the contentMode property of your custom content view to UIViewContentModeRedraw. This will cause your view to, as it sounds, redraw itself when its bounds changes. If your layout is done in drawRect based on the bounds rectangle, this should sort it for you.

Upvotes: 1

Related Questions