nslayoutconstraint

Swift - Programmatically refresh constraints

旧时模样 提交于 2021-02-10 06:15:22
问题 My VC starts with stackView attached with Align Bottom to Safe Area . I have tabBar, but in the beginning is hidden tabBar.isHidden = true . Later when the tabBar appears, it hides the stackView So I need function that refresh constraints after tabBar.isHidden = false When I start the app with tabBar.isHidden = false the stackView is shown properly. Tried with every function like: stackView.needsUpdateConstraints() , updateConstraints() , setNeedsUpdateConstraints() without success. Now I'm

MKMapView struggles with zero height constraint - edgeInsets of map view?

独自空忆成欢 提交于 2021-02-09 18:13:12
问题 I have an MKMapView about 300 high which collapses between two other views, simply animating the height up and down as you'd usually do when collapsing a view. @IBOutlet var heightMap: NSLayoutConstraint! @IBOutlet var theMap: MKMapView! When the view launches it is height zero.. override func viewDidLoad() { super.viewDidLoad() .. heightMap.constant = 0 } there's an infuriating warning... [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the

MKMapView struggles with zero height constraint - edgeInsets of map view?

五迷三道 提交于 2021-02-09 17:59:06
问题 I have an MKMapView about 300 high which collapses between two other views, simply animating the height up and down as you'd usually do when collapsing a view. @IBOutlet var heightMap: NSLayoutConstraint! @IBOutlet var theMap: MKMapView! When the view launches it is height zero.. override func viewDidLoad() { super.viewDidLoad() .. heightMap.constant = 0 } there's an infuriating warning... [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the

MKMapView struggles with zero height constraint - edgeInsets of map view?

人走茶凉 提交于 2021-02-09 17:58:49
问题 I have an MKMapView about 300 high which collapses between two other views, simply animating the height up and down as you'd usually do when collapsing a view. @IBOutlet var heightMap: NSLayoutConstraint! @IBOutlet var theMap: MKMapView! When the view launches it is height zero.. override func viewDidLoad() { super.viewDidLoad() .. heightMap.constant = 0 } there's an infuriating warning... [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the

Layout constraints not working with view.frame.size.height

ε祈祈猫儿з 提交于 2021-01-29 07:43:52
问题 I'm creating my UI programmatically and I want to make my UITextfield topAnchor to be based off the height of its containing UIView but it's not working. My UITextfield is inside a UIView and I want its topAnchor to be 0.15 the height of the UIView as such - containerView.frame.size.height * 0.15 but it seems the value is not picking up. All this is done in a UIView subclass and called in the ViewController let containerView: UIView containerView.translatesAutoresizingMaskIntoConstraints =

How do I have to modify my UIView extension if I wanted to animate the auto layout constraints afterward?

六月ゝ 毕业季﹏ 提交于 2021-01-28 18:11:07
问题 I have made an UIView extension to set my NSLayout anchors. Everything works just fine. But how can I modify my extension if I wanted to add an NSLayoutConstraint so I could animate the constraints afterward? Here is my current extension: extension UIView { func anchor(top: NSLayoutYAxisAnchor?, leading: NSLayoutXAxisAnchor?, bottom: NSLayoutYAxisAnchor?, trailing: NSLayoutXAxisAnchor?, padding: UIEdgeInsets = .zero, size: CGSize = .zero) { //translate the view's autoresizing mask into Auto