本文介绍了Xcode 6中的“显示”segue将视图控件呈现为iOS 7中的模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我的iPhone应用程序中有两个视图控制器(使用swift构建),使用Xcode 6.1构建并使用故事板。 第一个视图控制器嵌入在导航控制器中在故事板中,第二个视图控制器的segue是一个'Show'segue。 当应用程序运行时,它在iOS 8.x中正确显示转换为推送,但在iOS 7.x中它显示为没有导航栏的模式。 我的应用程序要求是将转换显示为推送,无论是iOS 7还是iOS 8.任何想法都可以在两个版本的推送中实现iOS? 我看到了一个提到此问题的相关帖子,但无法找到解决问题的方法:故事板中的自适应segue Xcode 6.推送是否被弃用? 感谢任何帮助... 谢谢解决方案 此解决方案在以下方面与其他解决方案不同: 它包括检查和验证问题的方法 问题的原因是t跑到源头(segue类型的变化) 解决方案非常简单(删除并重新创建新的segue) 请注意文中的要求 我刚给了非常详细的SO答案,完全解释了发生了什么以及为什么,但简单的解决方案是你可以删除Segue是不推,然后在故事板上重新创建它。原因是segue中可能存在xml的损坏(例如,请参阅扩展答案/说明如何确认此问题)。 确认之后在视图层次结构中至少有一个UINavigationController,确保segue不是手动segue,并且没有与之关联的动作(通过在故事板中查看segue作为源代码)。删除现有的segue,然后按住Ctrl键从UIView / UIControl拖动到目标视图控制器,如果需要自定义操作,则在 prepareForSegue 中拦截对目标控制器的调用。 另外,要确认此解决方案适合您,请执行以下: 验证您的初始视图控制器(带有箭头)是 UINavigationController,并且它具有正常的内容视图控制器,因为它是根视图控制器。 (或者你将初始视图控制器嵌入UINavigationController中) 阅读我对早期对一个非常相似的问题(上面链接)的回复的扩展评论。 I have two view controllers in my iPhone application (built with swift) built with Xcode 6.1 and uses storyboards.The first view controller is embedded in a navigation controller in the storyboard and the segue for the second view controller is a 'Show' segue. When the application is run, it properly shows the transition as a push in iOS 8.x, but in iOS 7.x it appears as a modal without the navigation bar.My application requirement is to show the transition as a push regardless of whether it's iOS 7 or iOS 8. Any ideas to get this working as push in both versions of the iOS?I saw a related post where this issue is mentioned, but could not find a solution to the problem: Adaptive segue in storyboard Xcode 6. Is push deprecated?Any help is appreciated...Thanks 解决方案 This solution is different from the others in the following ways:It includes a method to examine and verify the issueThe cause of the issue is traced to the source (a change in the segue type)The solution is very simple (delete and recreate a new segue)Please note the requirements in the textI just gave a very detailed SO answer that fully explains what is happening and why, but the simple solution is you can delete the Segue that is not pushing and then recreate it on the storyboard. The reason is that there is likely a broken bit of xml in the segue (see extended answer for example/instructions how to confirm this issue).After you confirm that you have at least one UINavigationController within the view hierarchy, be sure that the segue is NOT a manual segue and does NOT have an action associated with it (by viewing the segue in the storyboard as Source Code). Delete the existing segue and then Ctrl-drag from a UIView/UIControl to the target view controller and if custom action is needed intercept the call to destination controller in prepareForSegue. Also to confirm that this solution works for you please do the following:Verify that your initial view controller (with the arrow on it) is aUINavigationController and that it has a normal content viewcontroller as it's root view controller. (or that you embed yourinitial view controller inside of a UINavigationController)Read my extended comments on an earlier response to a very similar question (linked above). 这篇关于Xcode 6中的“显示”segue将视图控件呈现为iOS 7中的模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-29 17:25