Xib file: Can't drag a View from a xib file to a swift file

我与影子孤独终老i 提交于 2020-01-01 18:04:11

问题


I just dragged and dropped a View to a xib file. I added some constrains and tried to Ctrl drag from the View to a .swift file with the assistant editor, but it bounce back, what am I missing?


回答1:


The xib file needs to be a subclass of the file you are trying to ctrl+drag to.




回答2:


I was setting the View's custom class instead of the File's Owner. Once I set the File's Owner to the custom class, I was able to control-drag from the view in the storyboard over to my class. Hope this helps someone.



来源:https://stackoverflow.com/questions/32671642/xib-file-cant-drag-a-view-from-a-xib-file-to-a-swift-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!