Turned off auto layout for the view. However this doesn't work. I have no restraints regarding height. Only width that equal parent views width.
@IBOutlet weak var questionTextView: UITextView!
override func viewDidLoad() {
var newFrame = CGRectMake(0, 0, 300, 202)
questionView.frame = newFrame
}
Disabling autolayout is a quick and easy process that can be completed in just a few seconds. Simply open your design in Figma, select the layer you want to disable autolayout for, and then click on the “None” option in the Layout section of the properties panel. That's all there is to it!
Auto Layout defines margins for each view. These margins describe the preferred spacing between the edge of the view and its subviews. You can access the view's margins using either the layoutMargins or layoutMarginsGuide property. The layoutMargins property lets you get and set the margins as a UIEdgeInsets structure.
If you select Aspect Ratio for a single item, the width of the item is used as the numerator for the ratio, and the height is used for the denominator. If you select Aspect Ratio for multiple items, Auto Layout chooses the width of one of the items for the numerator and the height of another item for the denominator.
You can add auto layout to a selected frame, component, or component set from a few places: Use the keyboard shortcut ⇧ Shift A . In the right sidebar, click next to Auto layout with a frame selected. Right-click on a frame or object and select Add Auto layout.
Did you turn off auto layout for the entire nib in interface builder?
You can't turn off auto layout for specific sub-views in interface builder - you can only do it at runtime programmatically.
Based on what you said you still have a constraint active. How do you have constraints when you've turned off auto layout already?
If you have auto layout active, setting the height for your view by using the frame won't work since it'll conflict with auto layout rules.
If you need to change the height of a view with auto layout active, you'll need to create an IBOutlet
for your height constraint and modify that at runtime, i.e.:
@IBOutlet weak var heightConstraint: NSLayoutConstraint!
self.heightConstraint.constant = 200
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With