gpt4 book ai didi

ios - 自定义过渡动画显示 viewController 并闪烁

转载 作者:行者123 更新时间:2023-11-29 02:03:33 25 4
gpt4 key购买 nike

我正在使用自定义过渡动画,如推送动画。但是当我在我的 viewcontroller 加载完动画后使用这段代码时,它只是闪烁。

这是我用来展示我的 View Controller 的方法

+(void)leftpresentFrom:(UIViewController *)fromviewcontroller
To:(UIViewController *)toviewcontroller
{

CGPoint newcenter = CGPointMake(480, toviewcontroller.view.center.y);


toviewcontroller.view.center =newcenter;


toviewcontroller.view.clipsToBounds=YES;


[fromviewcontroller.view addSubview:toviewcontroller.view];


[UIView animateWithDuration:.5
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
toviewcontroller.view.center = CGPointMake(160 ,toviewcontroller.view.center.y);
}
completion:^(BOOL finished){
[toviewcontroller.view removeFromSuperview];
[fromviewcontroller presentViewController:toviewcontroller animated:NO completion:^{

}];

}];
}

最佳答案

您是否尝试在新 Controller 出现后删除 View ?

例如。

[fromviewcontroller presentViewController:toviewcontroller animated:NO completion:^{
[toviewcontroller.view removeFromSuperview];
}];

关于ios - 自定义过渡动画显示 viewController 并闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30069963/

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