- (无效)viewWillAppear中:(BOOL)动画检测自定义动画 [英] - (void)viewWillAppear:(BOOL)animated detect custom animation
问题描述
我有一个按钮,当pressed推视图控制器但是我使用自定义动画等等 pushViewController:childController动画:
设置为NO。我想要做虽然在我的检测到这种自定义动画 - (无效)viewWillAppear中:(BOOL)动画
方法,如果这样的语句写;
I have a button which when pressed pushes a view controller however i'm using a custom animation so pushViewController: childController animated:
is set to NO. What i want to do though is detect this custom animation in my - (void)viewWillAppear:(BOOL)animated
method and write an if statement like this;
- (void)viewWillAppear:(BOOL)animated {
if (customAnimation occured) {//Do this}
else {//Do this}
}
这是推视图控制器为我的按钮的方式。
This is the method for my button which pushes the view controller.
- (void)nextPressed:(id)sender {
childController = [[CategoryOneDetailController alloc] initWithNibName:xibDownName bundle:nil];
[UIView beginAnimations: @"Showinfo"context: nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController pushViewController: childController animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[childController release];
}
任何帮助将是非常美联社preciated,谢谢,萨米。
Any help would be much appreciated, thanks, Sami.
推荐答案
如果你不使用标准的动画,我觉得最好的办法就是添加属性被设置为是
在自定义动画(和 NO
默认情况下不会破坏任何现有的行为)的情况下。然后,你可以检查属性 viewDidAppear:
If you don't use standard animations, I think your best bet is to add a property to your pushed view controller that is set to YES
in case of a custom animation (and NO
by default to not break any existing behavior). Then you can check that property in viewDidAppear:
.
如果您需要自定义逻辑被执行的之后的动画已经用完,你可能想建立一个动画完成处理程序或块。
If you need your custom logic to be executed after the animation has run, you might want to set up an animation completion handler or block.
这篇关于 - (无效)viewWillAppear中:(BOOL)动画检测自定义动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!