简体   繁体   中英

UIImageView, that is embed in UIView, doesn't move with it

I have a UIView and UIImageView,which is embed in this UIView. When I move UIView from the top to the bottom, UIView moves the same. When UIView moves back, UIImageView doesn't move from the bottom of screen.Why? How to fix it?

1)to the bottom

- (IBAction)showAbautMovie:(id)sender {
[UIView animateWithDuration:1
                      delay:0.1
                    options: UIViewAnimationOptionTransitionFlipFromTop
                 animations:^{

                     _abautMovie.frame = CGRectMake(0, 0, 320, 568);
                 }
                 completion:^(BOOL finished){
                 }]
}

2) back to the top

- (IBAction)backAbautMove:(id)sender {
[UIView animateWithDuration:1
                      delay:0.1
                    options: UIViewAnimationOptionTransitionFlipFromBottom
                 animations:^{

                     _abautMovie.frame = CGRectMake(0, 0, 320, 268);
                 }
                 completion:^(BOOL finished){
                 }];

}

It most likely has to do with the constraints you have set on the UIImageView in relation to the UIView. If you set the UIImageView to have the constraints of staying attached to the bottom or top, it should move fine.

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