Last active
August 29, 2015 14:14
-
-
Save atheken/d7d80b97e41195e56069 to your computer and use it in GitHub Desktop.
Make "TranslatesAutoresizingMaskIntoConstraints" a drop-down in Interface Builder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBDesignable | |
class TranslateResizeMaskToConstraints: UIView { | |
@IBInspectable var Enabled:Bool = false | |
private var _interfaceBuilderContext = false | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
setTranslatesAutoresizingMaskIntoConstraints(Enabled || _interfaceBuilderContext) | |
} | |
override func prepareForInterfaceBuilder() { | |
_interfaceBuilderContext = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment