如何将项目添加到 Xcode 中的 Outlet Collection [英] How to add items to an Outlet Collection in Xcode

查看:23
本文介绍了如何将项目添加到 Xcode 中的 Outlet Collection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个测验应用程序,对于按钮,我需要一个插座集合.到目前为止,在数组中,我只有一个按钮,但我想添加其他三个.在我看过的另一个教程中,它说单击侧面的按钮并拖动到要添加的内容(下面的图片链接).这对我不起作用,您是否需要通过某种方式单击?我以前这样做过,但这次它不起作用.这次的不同之处在于我创建了一个新类.我对 Xcode 或 swift 不是很熟悉,抱歉.谢谢.

I am creating a quiz app and for the buttons I need an outlet collection. So far in the array, I only have one button but I want to add the other three. On the other tutorial I've watched, it says to click the button on the side and drag to the thing you want to add (image link below). This doesn't work for me, is there a certain way you need to click? I've done this before, but this time its not working. The difference this time is that I've created a new class. I am not very familiar with Xcode or swift, sorry. Thank you.

推荐答案

就插座连接而言,Xcode 确实存在缺陷.清空派生数据文件夹以及清理/重建帮助.但结果可能仍然存在问题.然而,在助理编辑器存在之前就已经存在的连接事物的旧方法仍然可靠地工作.选择 ViewController 并从连接编辑器中的 ITS 插座拖动到故事板项目(即按钮).

Xcode is really buggy as far as outlet connections are concerned. Emptying the Derived Data folder as well as clean / rebuild help. But results could still be problematic. However, the old way to connect things which has been around since before the existence of an Assistant editor still works reliably. Select the ViewController and drag from ITS outlets in the Connection editor to the storyboard items (i.e. buttons).

这篇关于如何将项目添加到 Xcode 中的 Outlet Collection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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