Created
July 23, 2014 21:10
-
-
Save gekitz/76cfc1d206d9d8742e71 to your computer and use it in GitHub Desktop.
Why do I have to do this, shouldn't autolayout figure out the height on it's own?
This file contains hidden or 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
class GKTextAlertContentView: UIView { | |
@IBOutlet var titleLabel: UILabel! | |
@IBOutlet var textLabel: UILabel! | |
@IBOutlet var textField: UITextField! | |
@IBOutlet var submitButton: UIButton! | |
override func intrinsicContentSize() -> CGSize { | |
let titleSize = titleLabel.intrinsicContentSize() | |
let textSize = textLabel.intrinsicContentSize() | |
let textFieldSize = textField.intrinsicContentSize() | |
let btnSize = submitButton.intrinsicContentSize() | |
let dist: CGFloat = 10.0 | |
let height = dist + titleSize.height + dist + textSize.height + dist + textFieldSize.height + dist + btnSize.height + dist + dist | |
return CGSize(width: 280, height: height) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why do I have to do this, shouldn't autolayout figure out the height on it's own?