Search code examples
iosobjective-cuikitios13

iOS 13 Animating View Not Changing Frame


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))
         */
    }];
}

}


Solution

  • 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.

    enter image description here