Problem when resizing UIWebView using animation

I struggled with this for a while and did not find a solution.

I resize UIWebViewusing animation through beginAnimations:and commitAnimations. Everything goes well, except when resizing tries to do UIWebViewmore.

Let me make it clearer. Suppose my current frame UIWebViewis equal (0, 0, 320, 300).

Then I try to resize it to (0, 0, 320, 340)using:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[self.webView setFrame:(CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width, 340))];
[UIView commitAnimations];

In doing so, I expect it to UIWebViewgo down 40 pixels, but in fact it has grown a little (about 10-20 pixels) and only AFTER it goes down to the desired position (so that it ends about 50-60 pixels) .

Does anyone know how to solve this? I want the bottom of mine to UIWebViewconverge when the method is called, so if there are other options for its execution, I would be happy to try it.

Many thanks.

0
source share
1 answer

Instead of animating a UIWebView frame, you should try animating the borders yourself, or perhaps the borders and center together. for example, increase the height by 40 while moving the center down by 20.

0
source

All Articles