故事板中的自适应segue Xcode 6.推送是否已被弃用? [英] Adaptive segue in storyboard Xcode 6. Is push deprecated?

查看:106
本文介绍了故事板中的自适应segue Xcode 6.推送是否已被弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,Xcode 6界面构建器具有新的复选框使用大小类。它使视图自适应。



何时我尝试在我的故事板中的两个视图之间制作segue我有新选项:



相反旧:





现在我们有show和present modally而不是push和modal。旧选项标记为已弃用。我选择了show选项,因为在segue设置中它称为show(例如推送)





但它没有推动。塞格动画看起来像从底部滑动(模态)和导航栏消失。



问题是:如何使show像push一样工作?是否可以或者我应该使用push(deprecated)来代替?我能找到有关segue新类型的任何信息吗?我在iOS8开发人员库中找到的唯一信息是。如果你看幻灯片,你会看到一张幻灯片(41)提到了这个变化。观看该会话视频时,您可以跳到38:00,开始谈论自适应segues。例如,他们确实解释了show自适应segue在决定如何进行新视图控制器的演示时会考虑上下文。


Xcode 6 interface builder by default has new checkbox "use size classes". It makes views adaptive.

When I try to make segue between 2 views in my storyboard I have new options:

instead old:

Now we have "show" and "present modally" instead of "push" and "modal". The old options are marked as deprecated. I've chosen "show" option, because in segue settings it called "show (e.g. push)

But it doesn't make push. Segue animation looks like slide from the bottom (modal) and navigation bar disappears.

Question is: How can I make "show" work like push? Is it possible or should I use "push (deprecated)" instead? Where can I find any information about new types of segue? The only thing that I've found in iOS8 developer library is Storyboards Help You Design Your User Interface but there is no information about "show" segue.

UPDATE

I tried to create new project and "show" is really works like "push". I think the issue in my project can be because I reuse navigation controller with code like this, but I don't know how to fix it.

if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {
    SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;

    swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {

        UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
        [navController setViewControllers: @[dvc] animated: NO ];
        [self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
    };

}

After that I try to push NewViewController after MainViewController

UPDATE 2:

I seems to be only iOS 7, iOS 7.1 issue.

解决方案

Yes, use ‘Show’ instead of ‘Push’

How can I make "show" work like push? Is it possible or should I use "push (depricated)" instead?

It should; it does for me. I am using Xcode 6 beta 2 and to test I used the single view template (calling the pre made view controller in IB ‘VC_A’). I then added another view controller (‘VC_B’). I then added a button on VC_A to show VC_B and another from VC_B back to VC_A. When I add a navigation controller as the initial view controller in the storyboard and make VC_A the rootViewController, both ‘push’ and ‘show’ have the same effect. If I don’t have an initial navigation controller and I use ‘show’ I get what you described in that the VC_B does a slide up from bottom. If I try to ‘push’ I get a crash since in order to do push I must have navigation controller. So it would seem that ‘show’ will do a push in the case where a navigation controller is provided and do a present with a modal transition style if a navigation controller is not present.

Where can I find any information about new types of segue?

So I found some information in the ‘What’s New in Interface Builder’ session here. If you look at the slides you will see one slide (41) mention the change. When watching that session video you can skip to minute 38:00 where they start talking about adaptive segues. They do explain that the ‘show’ adaptive segue, for example, takes the context in account when deciding how to do the presentation of a new view controller.

这篇关于故事板中的自适应segue Xcode 6.推送是否已被弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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