需要有关transitionFromView:toView:duration:options:completion的帮助: [英] Need assistance regarding transitionFromView:toView:duration:options:completion:

查看:80
本文介绍了需要有关transitionFromView:toView:duration:options:completion的帮助:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于 transitionFromView:toView:duration:选项:完成:苹果文档在最后几行中说了这一点:

Regarding transitionFromView:toView:duration:options:completion: Apple doc says this in last few lines:

此方法仅修改视图层次结构中的视图.确实 请勿以任何方式修改应用程序的视图控制器.为了 例如,如果您使用此方法来更改由 视图控制器,更新视图是您的责任 控制器以适当地处理更改.

This method modifies the views in their view hierarchy only. It does not modify your application’s view controllers in any way. For example, if you use this method to change the root view displayed by a view controller, it is your responsibility to update the view controller appropriately to handle the change.

如果ViewController具有2个全屏尺寸的视图,一次只能显示一个,则没有问题:

If a ViewController has 2 full screen size views display one at a time then no issues:

[transitionFromView:self.view到View:self.view2 ...

[transitionFromView:self.view toView:self.view2...

但这意味着您有责任适当更新视图控制器以处理更改吗??

如果我这样做:

secondViewController *sVc = [[secondViewController alloc]init];
[transitionFromView:self.view toView:sVc.view...

我如何适当地更新视图控制器以处理更改的职责?或如何更新ViewController?

how its my responsibility to update the view controller appropriately to handle the change? or how to update ViewController?

更新

我创建了一个单视图项目,添加了secondVC,然后在firstVC上单击按钮,我这样做了:

I created a single view projec, add secondVC then in firstVC on button tap i did this:

self.svc = [[secondVC alloc]init]; 

[UIView transitionFromView:self.view toView:self.svc.view duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {}];

... secondVC viewDidLoad正在工作,其nslog正在工作.

... secondVC viewDidLoad is working its nslog is working.

然后如何处理viewcontroller的更新?

Then how to handle updating of viewcontroller?

推荐答案

语句您有责任适当地更新视图控制器以处理更改."这意味着您必须适当地调用视图层次结构委托方法,例如:

The statement "it is your responsibility to update the view controller appropriately to handle the change." it meant that you have to appropriately call view hierarchy delegate methods such as:

- (void)viewDidLoad;
- (void)viewDidUnload;
- (void)viewWillAppear;
- (void)viewDidDisappear;

以及负责适当视图管理的其他方法.

And other methods that are responsible for proper view management.

以下是一些 查看全文

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