iPhone: animating UILabel width results in pre-stretched text
iPhone: animating UILabel width results in pre-stretched text
- Subject: iPhone: animating UILabel width results in pre-stretched text
- From: Rick Mann <email@hidden>
- Date: Fri, 18 Mar 2011 17:20:54 -0700
I have a table view that allows swipe-to-delete. When the delete button comes up, I want to shrink the UILabels in the custom cell to make room for the button.
So I implement -[tableView:willBeginEditingRowAtIndexPath:] and set up an animation that shrinks a view that contains my labels. All the subviews have frame bindings set up, and they shrink correctly.
The problem is that the text within the UILabels is pre-rendered at the new (narrower) size. The resulting image is then scaled to match the current (wider) size, and as everything animates, it shrinks to be the correct size.
The result is visually very unappealing: the text snaps to a larger (often truncated) look, then animates into place.
The reverse happens when widening if the delete operation is canceled.
Here's a movie showing what I'm talking about:
http://roderickmann.org/stuff/TextResize.mov
I tried setting the text content mode to "redraw," but that had no effect.
Any way to get it to re-render the text throughout the animation?
Looking closely at what Mail does, I see it replaces the wider view with the narrower version with a crossfade animation.
--
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden