简体   繁体   中英

UIView subview not animating

I have a UIView which animates its frame to full screen. It has a UIImageView as a subview which is the same size, it does resize but only at the end of the animation, it doesn't smoothly animate it's image. The Views Autoresize subviews has been set to YES; Any thoughts on this?

[UIView animateWithDuration:0.3
        delay:0 
        options:UIViewAnimationOptionAllowAnimatedContent          
        animations:^{
                      _View1.frame = fullScreenRect;
                    }
        completion:^(BOOL finished){;}];
[UIView animateWithDuration: 1.5f
                      delay: 0.0f
                    options: 0
                 animations:^{
                     self.View.frame = CGRectMake(10, 50 + height, width, height);
                 }
                 completion:^(BOOL finished) {
                 }];

This should do it

Animate them both in the block:

[UIView animateWithDuration:0.3
        delay:0 
        options:UIViewAnimationOptionAllowAnimatedContent          
        animations:^{
                      _View1.frame = fullScreenRect;
                       subview1.frame = fullScreenRect;
                    }
        completion:^(BOOL finished){;}];

您必须设置 _View1.clipsToBoud = YES;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM