skip to Main Content

Ios swift – Adding Constraints to view, whose topAnchor's is bottomAnchor of UIView with dynamic height, Swift, UIKit, Programmatic

I've created a UIView, which has buttons in it. I set the constraints like this : NSLayoutConstraint.activate([ sampleView.topAnchor.constraint(equalTo: topView.bottomAnchor, constant: 20), sampleView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), sampleView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16), ]) Not added any height or bottom anchor as I want…

VIEW QUESTION

NSLayoutConstraint animation glitch – Ios swift

I've decided to switch to constraints and face up with animation problems. In autoresizing mask world everything works fine. UIView is attached to right top. Content inside use autoresizing mask. Animate code: UIView.animate(withDuration: 0.3, delay: 0, options: [.curveEaseInOut]) { self.constraints.first(where:…

VIEW QUESTION

Layout not working when container view controller dynamically changes child view controller – Ios swift

I have a MainViewController that contains a ContainerViewController. The ContainerViewController starts out showing childViewControllerA, and dynamically switches it out to childViewControllerB when a button in the childViewControllerA is clicked: func showNextViewContoller() { let childViewControllerB = ChildViewControllerB() container.addViewController(childViewControllerB) container.children.first?.remove() // Remove…

VIEW QUESTION

I want to set label & Imageview in centre of myView but App crashing after adding some constraints – Ios swift

Error:- Thread 1: "Unable to activate constraint with anchors <NSLayoutXAxisAnchor:0x280af8500 "UILabel:0x103dc4fa0.centerX"> and <NSLayoutXAxisAnchor:0x280af89c0 "UIView:0x103dc49d0.centerX"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal." I've created a function programmatical in…

VIEW QUESTION
Back To Top
Search