IBOutlet and viewDidUnload under ARC

Just doing a bit of research… As I understand it, weak is similar to assign, in that they’re both weak references. However, assign does not create a zeroing reference. i.e. if the object in question is destroyed, and you access that property, you WILL get a BAD_ACCESS_EXCEPTION. Weak properties are automatically zeroed (= nil) when … 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

Connect outlet of a Cell Prototype in a storyboard

UPDATE: As of Xcode 4.6 (possibly earlier) you can now create outlets by control-dragging! – This has to be done into an interface section or class extension (the class extension doesn’t exist by default for new cell subclasses. Thanks to Steve Haley for pointing this out. You can’t get the outlet automatically connected and created … Read more

Strange error when adding items to prototype cells in storyboard-IB

In fact you can’t just make an outlet from a dynamic cell prototype in the UITableView delegate view controller. You’ll have to subclass UITableViewCell and then attribute this class to your prototype. Then you can Ctrl-Drag from the Label to the UITableViewCell subclass header file. Finaly you can access to this outlet in the delegate … Read more

IBOutletCollection set ordering in Interface Builder

EDIT: Several commenters have claimed that more recent versions of Xcode return IBOutletCollections in the order the connections are made. Others have claimed that this approach didn’t work for them in storyboards. I haven’t tested this myself, but if you’re willing to rely on undocumented behavior, then you may find that the explicit sorting I’ve … Read more

tech