简体   繁体   English

XCode 8.2无法将接口构建器IBOutlet连接到swift文件

[英]XCode 8.2 Can't connect interface builder IBOutlet to swift file

I'm looking for a solution specifically for the issue with a Swift3 UIViewController having IBOutlets defined, but dragging actions from storyboard does not connect them to existing outlets. 我正在寻找一个专门解决问题的解决方案,其中Swift3 UIViewController定义了IBOutlets,但是从故事板拖动操作并不会将它们连接到现有的插座。 I can add new outlets, just with different name, and they work (still cant re-connect them later). 我可以添加新的插座,只是使用不同的名称,并且它们可以工作(以后仍然无法重新连接它们)。

I see old solutions for objective-C dealing with headers and source files, but a swift is a single file per class. 我看到Objective-C处理头文件和源文件的旧解决方案,但swift是每个类的单个文件。

Is there a way to fix "can't connect IBOutlet to swift file" issue? 有没有办法解决“无法将IBOutlet连接到swift文件”的问题?

but dragging actions from storyboard does not connect them to existing outlets 但是从故事板拖动操作不会将它们连接到现有插座

I've noticed this too. 我也注意到了这一点。 But it's not a difficult problem. 但这不是一个难题。 Here's what to do: 这是做什么的:

Look carefully at the gutter next to the outlet in the code. 仔细查看代码中插座旁边的装订线。 There is a circle. 有一个圆圈。 Drag from that circle (no need for control-drag) to the view in the Interface Builder canvas. 从该圆(不需要控制拖动),以在界面生成器画布的视图阻力

在此输入图像描述

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

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