IBOutletCollection - 一次连接多个对象
我一直在使用 IBOutletCollections 将相同的行为应用于 IB 中连接的许多对象。这是一个很好的节省时间的方法,但是单独建立 IB 中的每个对象和我的头文件中声明的 IBOutletCollection 之间的连接仍然需要很长时间。
我尝试在 IB 中突出显示多个接口对象并将连接拖动到 IBOutletCollection,但即使如此,它仍然一次只连接一个。有没有一种隐藏的方式可以同时连接多个人?
谢谢
I've been using IBOutletCollections to apply the same behaviour to many objects which are hooked up in IB. This is a great time saver, but it still takes a long time to individually make the connection between each object in IB and the IBOutletCollection declared in my header file.
I've tried highlighting multiple interface objects in IB and dragging a connection to the IBOutletCollection, but even so it still only hooks them up one at a time. Is there a hidden way to connect many at once?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的...这比你想象的要难。我在 bugreporter.apple.com 上推荐雷达。
在我的代码中,我偶尔会使用这样的代码来完成此操作。当我决定更改所有按钮的字体、背景颜色或其他任何内容时,它可以节省大量时间、麻烦和错误。它赋予了IB的布局优势和代码的一致性。
当我需要递归收集所有控件时,我使用类似的技术(我将其用于弹出窗口直通视图,但它对于批量禁用也很有用):
Yeah... it is harder than you'd think. I recommend a radar at bugreporter.apple.com.
In my code, I've occasionally resorted to doing it in code like this. It saves a lot of time, hassle and bugs when I decide to change the font for all the buttons, or the background color or whatever. It gives the layout advantages of IB with the consistency of code.
I use a similar technique when I need to recursively collect all the controls (I use this for popover passthrough views, but it's also useful for mass disable):