When you do a right swipe gesture on a table cell in the iPhone’s Mail app, a delete button appears and the text reflows around the button, like so:

Swipe & Delete

I built a similar interface that looks and functions similarly. The only problem was that when you right swiped, the delete button would appear, but the text would not reflow. Looking at the API docs, I made sure that all the subviews were added to the UITableViewCell’s contentView. I found a post on Stack Overflow that mentioned setting the contentMode property to UIViewContentModeLeft, but that didn’t work for me.

After digging around some more, I discovered that the autoresizingMask property of UILabel defaults to UIViewAutoresizingNone. When i set autoresizingMask to UIViewAutoresizingFlexibleWidth in the two UILabels (subject & body preview), they now reflow automatically when the delete button appears.

No related posts.