在xcode5中的viewcontroller层次结构外部的界面构建器中显示视图 [英] Showing views in interface builder outside viewcontroller hierarchy in xcode5

查看:162
本文介绍了在xcode5中的viewcontroller层次结构外部的界面构建器中显示视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常在视图控制器层次结构之外的界面构建器中使用视图(参见下面的屏幕抓取以获取简单示例)。

I often make use of views in interface builder that live outside of the viewcontroller hierarchy (see screen grab below for simple example).

在升级到Xcode5之前我可以通过编写IBAction插座并将代码中的连接拖到故事板中的视图,使此视图显示在故事板上。

Before upgrading to Xcode5 I could get this view to appear on the storyboard by writing an IBAction outlet and dragging a connection from the code to the view in the storyboard.

如果您暂停按钮以获取那一刻它会闪现,然后打开作为故事板上的一个视图,然后更容易使用。

If you paused over the button for a moment it would flash and then open up as a view on the storyboard that is then a lot easier to work with.

由于升级此功能似乎不再可用。有没有人发现如何让这些视图出现在故事​​板上?

Since upgrading this function no longer seems available. Has anyone found out how to get these views to appear on the storyboard?

编辑:
使用临时viewcontroller,如这个答案似乎是一种方法,虽然很繁琐,因为每次想要编辑布局时都需要在viewcontrollers之间移动UIView堆栈。使用单独的XIB开始看起来是最安全的方法。

Using the temporary viewcontroller as described in this answer seems one approach, although fiddly since you need to move the UIView stack between viewcontrollers each time you want to edit the layout. Using a separate XIB is starting to seem like the sanest approach.

https: //stackoverflow.com/a/13713385/1060154

推荐答案

最后,我们回到Xcode 7。
Hallelu!

Finally, we get this back in Xcode 7. Hallelu!

这篇关于在xcode5中的viewcontroller层次结构外部的界面构建器中显示视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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