简体   繁体   English

在最新的xcode 5中将故事板分别添加到情节提要中后看不到UIView

[英]Can't see UIView after added to UIViewController in storyboard separately in latest xcode 5

I have drag & drop UIView to UIViewController in storyboard in xcode 5, it's added but i can't see that UIView in storyboard. 我已经将UIView拖放到xcode 5的情节提要中的UIViewController中,已添加,但我看不到Storyboard中的UIView。 Any one have solution? 有人解决吗?

In previous version of xcode, i did get it worked with the process described from following link:- https://stackoverflow.com/a/14515818/952440 在以前版本的xcode中,我确实将其与以下链接中描述的过程一起使用: -https : //stackoverflow.com/a/14515818/952440

But now it did not work in latest xcode 5. 但是现在它在最新的xcode 5中不起作用。

For your information i have added screenshot from storyboard below:- 为您提供信息,我在下面的情节提要中添加了屏幕截图:-

文档大纲的屏幕截图

视图控制器底部的屏幕截图

You have to add these views as subviews of the main view. 您必须将这些视图添加为主视图的子视图。 Just drag them into the top View . 只需将它们拖到顶部View

If you don't want to show them by default, set them as hidden and show them dynamically. 如果您不想默认显示它们,请将它们设置为隐藏并动态显示。

To edit them, you could create them in a separate xib and then copy-paste. 要编辑它们,您可以在单独的xib中创建它们,然后复制粘贴。 That being said, I do not recommend to put views into storyboard that are not part of the application flow (the "story"). 话虽这么说,我不建议将不属于应用程序流(“故事”)的视图放入故事板。 That is what xibs are for. 那就是xib的目的。 If, however, the views really belong to this controller, then add them as subviews as suggested above. 但是,如果视图确实属于该控制器,则按照上述建议将它们添加为子视图。

First of all your custom views "forgotPasswordView" and "SignUpView" must be subviews of your viewcontroller's view (LoginSignUp View Controller). 首先,自定义视图“ forgotPasswordView”和“ SignUpView”必须是视图控制器视图(LoginSignUp View Controller)的子视图。 From the screenshot it appears to lie outside and that is why they are not appearing up. 在屏幕截图中,它似乎位于外面,这就是为什么它们没有出现的原因。 You can simply drag and drop them at right place. 您只需将它们拖放到正确的位置。

Additionally, make sure in your custom view classes you are implementing "initWithCode" initialization method for any initialization code. 此外,请确保在自定义视图类中为所有初始化代码实现“ initWithCode”初始化方法。

Also see for reference: 另请参阅以供参考:

How can I make my UIView visible in Xcode's Storyboard editor? 如何在Xcode的Storyboard编辑器中显示UIView?

Now, we can see view outside of UIViewController in storyboard in Xcode 7. 现在,我们可以在Xcode 7的情节提要中看到UIViewController外部的视图。

For your information i have added screenshot from Xcode 7.1 storyboard below:- 为了给您提供信息,我在下面的Xcode 7.1故事板上添加了屏幕截图:

在此处输入图片说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM