问题
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