如何使用故事板在 4.2 Xcode 中创建自定义模态转场 [英] How to create custom modal segue in 4.2 Xcode using storyboard
本文介绍了如何使用故事板在 4.2 Xcode 中创建自定义模态转场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用故事板来创建我的新 iPad 项目.我想使用自定义模式 segue 在视图之间进行更好的转换.我的问题是如何使用自定义模态,是否有任何教程显示使用自定义模态转场?
I'm using storyboard to create my new iPad project. I want use the custom modal segue to have better transitions between views. My question is how do I use the custom modal and is there any tutorials out there that show using custom modal segues?
推荐答案
这个自定义序列弹出回到导航堆栈的根.如果您想返回一级,请使用普通 pop 而不是popToViewController".我就是喜欢这个方法的名字.
This custom seque pops back to the root of a navigation stack. Use a normal pop instead of "popToViewController" if you want to go back one level. I just love the name of this method.
标题:
#import <UIKit/UIKit.h>
@interface FlipTopPopToRoot : UIStoryboardSegue
@end
实现:
#import "FlipTopPopToRoot.h"
@implementation FlipTopPopToRoot
- (void) perform {
UIViewController *src = (UIViewController *) self.sourceViewController;
[UIView transitionWithView:src.navigationController.view duration:0.5
options:UIViewAnimationOptionTransitionFlipFromTop
animations:^{
[src.navigationController popToViewController:[src.navigationController.viewControllers objectAtIndex:0] animated:NO];;
}
completion:NULL];
}
@end
这篇关于如何使用故事板在 4.2 Xcode 中创建自定义模态转场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文