Search code examples
iphoneuitextfieldiboutletcollection

How Can I orderly arrange items in Referencing Outlet Collection automatically?


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?


Solution

  • This is an unfortunate fact of IBOutletCollection. You may want to dupe rdar://12121242.

    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.