gpt4 book ai didi

iOS 6 自定义容器 View Controller

转载 作者:行者123 更新时间:2023-12-01 16:49:14 25 4
gpt4 key购买 nike

我有一个自定义 View 容器,它使用以下代码来关闭当前的 viewController 并呈现前一个......

- (void)popToViewControllerwithAnimation:(AnimationStyle)animation
{
if(self.currentChildIndex == 0)
return;

UIViewController *currentChildController = self.childViewControllers[self.currentChildIndex];

self.currentChildIndex--;

UIViewController *previousChildController = self.childViewControllers[self.currentChildIndex];

if(animation == kSlideRight || animation == kSlideDown) {

CGRect onScreenFrame = self.view.bounds;

CGRect offScreenFrame = self.view.bounds;

CGFloat duration = 0.35;

if(animation == kSlideRight) {

offScreenFrame.origin.x += offScreenFrame.size.width;

duration = 0.3;
}

if(animation == kSlideDown)
offScreenFrame.origin.y += offScreenFrame.size.height;

[currentChildController willMoveToParentViewController:nil];

[self addChildViewController:previousChildController];

[UIView animateWithDuration:duration delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{

currentChildController.view.frame = offScreenFrame;

previousChildController.view.transform = CGAffineTransformIdentity;

previousChildController.view.frame = onScreenFrame;

} completion:^(BOOL finished) {

[currentChildController.view removeFromSuperview];

[currentChildController removeFromParentViewController];

[previousChildController didMoveToParentViewController:self];

}];

}
}

previousViewController 外,一​​切正常外观方法永远不会被调用......

有什么建议么?

最佳答案

你永远不会添加 previousChildController.viewself.view .

关于iOS 6 自定义容器 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17570322/

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