如何自动在“参考插座收藏"中有序排列项目? [英] How Can I orderly arrange items in Referencing Outlet Collection automatically?
问题描述
我在Xib中将UITextfields的Referenceing Outlet集合按一个接一个地排列.当我打印参考出口集合时,我发现它是无序的.我需要自动排列文本字段,即文本fileld在UI中排在第一位,应该在Outlet Collection Array中排在第一位.有什么主意吗?
I have Referencing Outlet Collection of UITextfields arranged in Xib as one below another. When I print Referencing Outlet Collection I found that its orderless. I need to automatically arrange text fields, ie text fileld comes 1st in UI should appear 1st in Outlet Collection Array. Any idea?
推荐答案
这是 IBOutletCollection
的不幸事实.您可能要复制 rdar://12121242 .
This is an unfortunate fact of IBOutletCollection
. You may want to dupe rdar://12121242.
您可以为IB中的每个视图设置标签,然后按标签
对集合进行排序.您还可以按帧原点对集合进行排序.无论哪种情况,您都必须在 viewDidLoad
中手动完成.
You can set a tag for each view in IB, and then sort the collection by tag
. You can also sort the collection by frame origin. In either case, you will have to do this by hand in viewDidLoad
.
这篇关于如何自动在“参考插座收藏"中有序排列项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!