自定义视图(xib)在情节提要板上不可见 [英] Custom view (xib) not visible on storyboard

查看:67
本文介绍了自定义视图(xib)在情节提要板上不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义视图 xib ,其中有多个 TableViews .我将其加载到 ViewController 中作为嵌套视图:

I have a custom view xib where I have multiple TableViews. I am loading this inside a ViewController as a nested view:

ViewController
   |_ View
       |_ View (This is where I load my Custom View)

运行我的应用程序时,我可以在屏幕上看到空表,因此我的xib正确加载了.
到现在为止还挺好.

When I run my app, I can see the empty tables on screen, so my xib is loading correctly.
So far so good.

我的问题是,我无法在情节提要中看到我的桌子.因此,我无法按 ctrl +拖动并继续进行操作.

My problem is, I am unable to see my tables in the storyboard. So I am not able to ctrl+drag and proceed further.

如何在情节提要视图中看到我的自定义视图?

How can I see my custom view inside the storyboard view?

推荐答案

故事板只能包含ViewController和Segues.如果要从ViewController访问xib中的内容以设置委托等,则必须从代码中进行操作.例如,当目标 ViewController 在情节提要中且 UITableView 是在情节提要中时,您不能在IB中设置 UITableView 的委托.在另一个xib中.

Storyboards can only contain ViewControllers and Segues. If you want to access something in your xib from the ViewController to set the delegates etc., then you have to do it from code. You can't, for example, set the delegate of a UITableView from within IB when the target ViewController is in a Storyboard and the UITableView is in another xib.

这篇关于自定义视图(xib)在情节提要板上不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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