Swift and autoresizingMask

By | July 20, 2014

Short tutorial how to set autoresizingMask in Swift.

In Objective-C it looked something like this:

spinner.autoresizingMask = (UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin);

In Swift you would rather write:

spinner.autoresizingMask = UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin

One thought on “Swift and autoresizingMask

Leave a Reply