Animating the UIWebView Inline Frame Property

after a long search with no results, maybe someone knows the answer to the following problem:

I have a UIView that contains a UIWebView as a subtitle. UIView is just a shell, so I can place buttons, etc. On top of the UIWebView. Now I want to animate the resizing and moving of the UIView and UIWebView at the same time. I want it to look like only the UIWebView has been changed. I tried various animation methods: block / commit, implicit / explicit, for example:

[UIView beginAnimations:@"zoomIn" context:nil]; [UIView setAnimationDuration:1.0]; myWrapperUIView.frame = CGRect(0.0, 0.0, 500.0, 500.0); myUIWebView.frame = CGRect(0.0, 0.0, 500.0, 500.0); [UIView commitAnimations]; 

but I always get a result that UIView supports the right view, but the UIWebView inside instantly switches to a new frame, so if I zoom in from a larger frame, the space around the UIWebView will be reduced, which is reduced during the animation.

I also tried the inline animation for UIWebView, but the same result.

My question is:
Is there a way to simultaneously animate both views so that UIWebWill fills in the UIView at any given time?

Thanks,
Michael

+6
source share
2 answers

use CGAffineTransform and scale the view using the transform property, it will complete the task.

 myWrapperUIView.frame = CGRect(0.0, 0.0, 500.0, 500.0); myUIWebView.frame = CGRect(0.0, 0.0, 500.0, 500.0); self.window.userInteractionEnabled =NO; myWrapperUIView.transform = CGAffineTransformMakeScale(0.01, 0.01); myUIWebView.transform = CGAffineTransformMakeScale(0.01, 0.01); [UIView animateWithDuration:ANIMATIONDURATION animations:^{ myWrapperUIView.transform = CGAffineTransformMakeScale(1.0, 1.0); myUIWebView.transform = CGAffineTransformMakeScale(1.0, 1.0); }completion:^(BOOL finished) { self.window.userInteractionEnabled = YES; }]; 

HOPE THIS HELP

+1
source

You must set the autoresist mask to view on the Internet.

http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html

@property(nonatomic) UIViewAutoresizing autoresizingMask

0
source

Source: https://habr.com/ru/post/885984/


All Articles