In AppKit (or UIKit) projects where I’ve decided to implement user interfaces strictly in code, rather than through storyboards or xibs, it gets tiresome to repeatedly type the following code:
Here’s a little snippet I’ve been using to cut down on this somewhat:
This works for almost all views I create but occasionally I want to use some of the convenience initializers for
labelWithString. In those cases, I don’t use the method above, I just disable autosizing manually.