接线插座收集问题 [英] Wiring up Outlet Collection Trouble

查看:25
本文介绍了接线插座收集问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,在连接插座集合方面,人们在 XCode6 中遇到了一些挑战.我只是想看看我这样做是否正确或我需要正确做些什么!我在这里查看 无法连接插座使用故事板以及其他区域在 Xcode 6 中收集,但我想先对此进行更基本的了解.

From what I can tell there are some challenges people are having in XCode6 in terms of wiring up outlet collections. I just wanted to see if i'm doing this right or what I need to do correctly! I reviewed here Can't hook up an outlet collection in Xcode 6 using storyboard as well as other areas, but I wanted to be more basic about this first.

我在屏幕上有 7 个图像.我想以循环或其他方式遍历所有这些.我读了一个出口收藏将是一个明智的方式来做到这一点.要创建一个插座集合,我这样做:

I have 7 images on a screen. I'd like to iterate through all of them in a loop or something. I read an outlet collection would be a sensible way to do this. To create an outlet collection, I am doing this:

  1. 在拆分屏幕(左侧故事板,右侧助理编辑器)时,我控制+单击我的 7 个图像之一,并将其​​拖到右侧的视图控制器代码中.这将提示我创建一个插座或插座集合(我选择插座集合).
  2. 现在已完成此操作,此变量旁边的左边距中会出现一个圆圈,表示该图像与该变量相关联.如果我将鼠标悬停在圆圈上,第一张图片就会亮起.
  3. 您应该做什么(有人可以确认一下吗??)您只需将鼠标悬停在圆圈上,就会出现一个 + 符号,您只需按住鼠标左键,然后拖到到另一个图像(例如图像#2),它应该自动将其添加到集合中.这个想法是简单地拖动到每个图像,以便将它们全部添加.

在上面的第 3 步中是否正确?这是将项目添加到集合的正常方式吗?从 + 拖动到控制器中的图像?对我来说,当我这样做时,线会出现,但似乎没有响应将线连接到任何东西.我只是将它悬停在图像上,它不会突出显示图像或选择它或任何东西,当我松开时,什么也没有发生.

Is that right in step #3 above? Is this the normal way you would add items to a collection? Drag from the + to the image within your controller? For me, when I do this, the line appears, but it doesn't seem to respond to connecting the line to anything. I just hover it over the images, and it doesn't highlight the image or select it or anything, and when I let go, nothing happens.

我对此还是有点陌生​​ - 我做错了什么?

I'm still somewhat new to this - what am I doing wrong?

非常感谢您的耐心/帮助!

Thanks so much for your patience/help!

推荐答案

好的,我遇到了同样的问题,我想我刚刚找到了解决方法


1) 用第一张图片做第一步和第二步

2)现在完全重复您使用第二张图片所做的事情 - 在第一个出口集合下方拖放(这将简单地创建第二个出口集合,使用完全相同的名称)

3) 现在 Xcode 不会喜欢它,因为您有两个同名的 outletCollections.现在注释掉第一个

4) 现在您只有一个插座系列.它将连接到您的两个图像.通过将鼠标指针悬停在 IBOutlet 旁边的小圆圈"上以查看突出显示的图像来确认.

OK I had the same issue and I think I have just found a workaround


1) Do steps one and 2 with the first image

2) Now repeat exactly what you did using the second image - drag and drop just below the first outlet collection (this would simply create a second outlet collection use exactly the same name )

3) Now Xcode won't like it as you have two outletCollections with the same name. Now comment out the first one

4) Now you only have one outlet collection. And it would be wired up to both your images. confirm it by hovering your mouse pointer over the little 'circle' next to the IBOutlet to see your images being highlighted.

这似乎对我有用.所以希望这会有所帮助:-)

This seems to work for me. So hope this helps :-)

这篇关于接线插座收集问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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