iOS 13动画视图未更改框架 [英] iOS 13 Animating View Not Changing Frame

查看:66
本文介绍了iOS 13动画视图未更改框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在iOS 13模拟器上以Xcode 10编译的应用程序.在一个视图中,有一个托盘"视图,在点击时从底部显示,在iOS 12中它可以正常工作,在iOS 13中,水龙头调用了该方法,但是对框架的更改没有保存-我已包含输出从调试器中添加注释,以便您可以看到帧值的输出是什么;

I have an app which is compiled in Xcode 10 on iOS 13 simulator. In one view there is a "tray" view which shows from the bottom when tapped, in iOS 12 it works perfectly, in iOS 13, the tap is calling the method, but the changes to the frame are not saving - I have included outputs from the debugger in comments so you can see what the outputs of the frame values are;

- (void) userClickActivityTray: (UITapGestureRecognizer *) gestureRecognizer {
if(self.activityTrayShown) {
    /*
     (lldb) po self.activityTrayContainerView.frame
     (origin = (x = 0, y = 792), size = (width = 414, height = 104))
     */
    [self hideActivityTray];
} else {
    if (!self.activityTrayViewInitialFrameComputed) {
        self.activityTrayViewInitialFrameComputed = YES;
        self.activityTrayInitialFrame = self.activityTrayContainerView.frame;
    }

    /*
     (lldb) po self.activityTrayContainerView.frame
     (origin = (x = 0, y = 638), size = (width = 414, height = 224))
     (origin = (x = 0, y = 638), size = (width = 414, height = 224))

     (lldb) po self.activityTrayInitialFrame
     (origin = (x = 0, y = 792), size = (width = 414, height = 104))
     (origin = (x = 0, y = 792), size = (width = 414, height = 104))

     (lldb)
     */

    [UIView animateWithDuration:0.25 animations:^{
        self.activityTrayContainerView.frame = CGRectMake(self.view.bounds.origin.x,
                                                          self.bottomView.frame.origin.y - self.activityTrayViewController.maximumHeight,
                                                          self.view.bounds.size.width,
                                                          self.activityTrayViewController.maximumHeight);

        self.activityTrayBackgroundView.alpha = 1.0;
        self.bottomView.alpha = self.dotsProgressView.alpha = 0;
    } completion:^(BOOL finished) {
        self.activityTrayShown = YES;
        /*
         (lldb) po self.activityTrayContainerView.frame
         (origin = (x = 0, y = 557), size = (width = 414, height = 305))
         (origin = (x = 0, y = 792), size = (width = 414, height = 104))
         */
    }];
}

}

推荐答案

iOS 13中的布局系统有所不同,我们遇到了相同的问题,在本例中,通过将layoutautomatic切换为Translates Mask Into Constraints解决了该问题.

Layout system in iOS 13 is different, we had the same issue and in our case by switching layout from automatic to Translates Mask Into Constraints fixed the issue.

这篇关于iOS 13动画视图未更改框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆