如何使用情节提要在 4.2 Xcode 中创建自定义模态 segue [英] How to create custom modal segue in 4.2 Xcode using storyboard

查看:19
本文介绍了如何使用情节提要在 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?

推荐答案

此自定义序列弹回导航堆栈的根.如果您想返回一级,请使用普通弹出窗口而不是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屋!

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