gpt4 book ai didi

ios - UIView transitionFromView 改变 View 高度

转载 作者:行者123 更新时间:2023-11-28 18:10:41 26 4
gpt4 key购买 nike

我正在使用这段代码在 2 个 UIView 之间切换:

UIViewAnimationOptions animationType = UIViewAnimationOptionTransitionFlipFromLeft;

[UIView transitionFromView:self.playlistTableView toView:self.playerView duration:0.5 options:animationType completion:^(BOOL finished){
[self.containerView sendSubviewToBack:self.upperView];
[self.containerView sendSubviewToBack:self.playerView];

self.isPlaylistVisible = !self.isPlaylistVisible;
isControlsHidden = NO;
}];

我注意到一个奇怪的行为,当我翻转时 self.playerView 的高度松动 20px,一秒钟后它又增加回正常的帧大小。

我尝试将 animationType 更改为 UIViewAnimationOptionLayoutSubviews,现在当我在 View 之间更改时,不会发生此行为。知道可能是什么问题吗?

最佳答案

请尝试此代码。

        [self.upperView setHidden:YES];
[self.playerView setHidden:NO];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:containerView cache:YES];
[UIView setAnimationDuration:1.0];
[UIView commitAnimations];
[containerView addSubview:self.playerView];

获取反向大小写

    [self.upperView setHidden:NO];
[self.playerView setHidden:YES];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:containerView cache:YES];
[UIView setAnimationDuration:1.0];
[UIView commitAnimations];
[containerView addSubview:self.upperView];

关于ios - UIView transitionFromView 改变 View 高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21828217/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com