What is Referencing outlet collection in Xcode4 Interface Builder?

The IBOutletCollection is a way to group IBOutlets. Imagine that you have 3 or 4 UILabels, on which you will apply a style (font, backgroundColour, opacity, etc). With a IBOutletCollection, it becomes trivial to do this. First you need to define your IBOutletCollection: @property (nonatomic, retain) IBOutletCollection(UILabel) NSArray *labelsCollection; (notice the type we are putting … Read more

Swift put multiple IBOutlets in an Array

you can define a generic outlet collection in Swift like this: @IBOutlet var collectionOfViews: Array<UIView>? // = [UIView]? or for e.g. UIButton objects: @IBOutlet var collectionOfButtons: Array<UIButton>? // = [UIButton]? you can find your collections under the Outlet Collections group as usually are in the File’s Owner: it would look on my console after connecting … Read more

Swift – IBOutletCollection equivalent

Update: This works properly in Xcode now – “Outlet Collection” is one of the connection options in Interface Builder, which creates something that looks like: @IBOutlet var labelCollection: [UILabel]! While we’re waiting for a fix, you can approximate this using a computed property. Let’s say my view has five UILabels that I want in a … Read more

tech