如何使用故事板在4.2 Xcode中创建自定义模态segue [英] How to create custom modal segue in 4.2 Xcode using storyboard
本文介绍了如何使用故事板在4.2 Xcode中创建自定义模态segue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用故事板来创建我的新iPad项目。我想使用自定义模态segue在视图之间有更好的过渡。我的问题是如何使用自定义模态,是否有任何教程使用自定义模态segues显示?
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?
推荐答案
这自定义seque弹回到导航堆栈的根目录。如果要返回一个级别,请使用普通的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中创建自定义模态segue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文