ChrisP
ChrisP

Reputation: 10116

How to reformat a custom UITableViewCell during editing mode to accommodate Delete controls?

I have a custom UITableViewCell that contains a UILabel where variable amounts of text are displayed. The height for the cell is dynamically calculated to accomodate the amount of text.

The problem is the UILabel/text is not being reformatted during the Edit mode (Delete) as shown in the following screen captures.

I need to use custom cells rather than the standard textLabel etc. as other rows have more complex situations w/ multiple controls compared to this one w/ just a single UILabel.

a) Here's the table cells w/ the UILabel control. The height of each cell is dynamically calculated based upon the amount of text.

Before edit

b) When the Edit mode starts the editing control (red circle) is displayed which pushes the text off the right side of the screen.

Edit control displayed, text off screen

c) Then when an editing control is selected and the Delete button is displayed it overlaps the text.

Delete button overlaying text

The objective is to have the text area (UILabel frame) reduce it's width and increase the height to accommodate all the text when editing starts "b)". When the Delete button is displayed "c)" the text height would stay the same and the text that does not fit can be truncated and an elipsis "..." displayed.

Upvotes: 4

Views: 1705

Answers (1)

Paul Tiarks
Paul Tiarks

Reputation: 1921

This should be attainable by making sure that you're adding the UILabel to the contentView of the UITableViewCell and that you've properly set the autoresize masks on the UILabel. Have you already tried that?

Upvotes: 4

Related Questions