展开转场 - 动画

6
我在这里读到了一篇关于 unwind segues 的很好的解释:What are Unwind segues for and how do you use them?。然后我尝试在我的项目中使用,一切都运行正常,只有一个问题:与 Xcode 提供的“push segue”不同,unwind segues 默认情况下会执行动画效果。为了去掉这个动画效果,我必须使用自定义 push segue,并按照Push segue in xcode with no animation中的步骤进行操作。请注意,HTML 标签将被保留。
#import <UIKit/UIKit.h>

@interface PushNoAnimationSegue : UIStoryboardSegue

@end

#import "PushNoAnimationSegue.h"

@implementation PushNoAnimationSegue
-(void) perform{
    [[[self sourceViewController] navigationController] pushViewController:[self destinationViewController] animated:NO];
}
@end

我该怎么做才能关闭 unwind segue 的动画?有人可以帮忙吗?


1
苹果已经在示例项目中实现了解开功能,请查看 https://developer.apple.com/library/iOS/samplecode/UnwindSegue/Listings/CustomUnwindSegue_QuizContainerFadeViewControllerSegue_m.html#//apple_ref/doc/uid/DTS40013644-CustomUnwindSegue_QuizContainerFadeViewControllerSegue_m-DontLinkElementID_6 ,您可以将动画设置为无。 - Retro
1个回答

3

对于iOS9:

Xcode7中的Interface Builder列出了unwind segues。您可以从中选择并简单地取消选中animated属性以关闭unwind动画。

Animates property of an unwind segue

对于iOS 7和8:

在目标控制器的unwind方法中,您必须使用animated: NO弹出。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接