I have a UITextView, and I am trying to animate a change of frame when the user taps on a button. Basically the text view grows larger to fit the screen so it can display more text, and then when the user taps the button again it shrinks to its original frame.
I perform the animation using blocks, like this:
if(!isDisplayingDetailView)
{
//Expand view
[UIView animateWithDuration:0.5
animations:^{
self.detailView.frame = self.view.frame;
}
completion:^(BOOL finished){
isDisplayingDetailView = YES;
}];
}
else{
//Shrink view.
[UIView animateWithDuration:0.5
animations:^{
self.detailView.frame = self.detailFrame;
}
completion:^(BOOL finished){
isDisplayingDetailView = NO;
}];
}
Where self.detailView is the UITextView, and self.detailFrame is just a CGRect holding the original frame. isDisplayingDetailView is just a BOOL to check if the view is expanded or not. My problem is that the text resize is not animating. I made some screenshots from a test app to illustrate my problem: App default view:
The expanded view:
The textview just a moment after tapping the button:
As you can see the text automatically shrinks to the final frame size, without any kind of animation, while the bounds still are animating. I guess that's the right behavior, but I'd like to know if it's possible to animate the text along with its view.