ios-autolayout
Dividing screen in to 1/3 and 2/3 views using autolayout
Make an “Equal widths” constraints between your view and the super view with multiplier 2:3 for one view and 1:3 for the other. See picture. “Equal height” if you want to split in the other direction.
How to get real size UIView with autolayout
Before your “getting real size code”, insert the following code: [view setNeedsLayout]; [view layoutIfNeeded];
Swift dynamic table cell height [duplicate]
You should use UITableViewAutomaticDimension provides a solution for displaying dynamic content. Use below code in viewDidLoad: tableView.estimatedRowHeight = YourTableViewCellHeight tableView.rowHeight = UITableView.automaticDimension Read more from here Hope it helps. 🙂
Why weak IBOutlet NSLayoutConstraint turns to nil when I make it inactive?
When your outlet is weak, the only strong reference is from the view’s constraints property. Deactivating the constraint removes it from that array, so there are no more strong references.
How to keep a round imageView round using auto layout?
Unfortunately you cannot do this using cornerRadius and autolayout — the CGLayer is not affected by autolayout, so any change in the size of the view will not change the radius which has been set once causing, as you have noticed, the circle to lose its shape. You can create a custom subclass of UIImageView … Read more
In iOS 12, when does the UICollectionView layout cells, use autolayout in nib
For all solutions, note that there is no need to explicitly call reloadData in viewDidLoad: it will happen automatically. Solution 1 Inspired by Samantha idea: invalidateLayout asynchronously in viewDidLoad. override func viewDidLoad() { super.viewDidLoad() //[…] for _ in 0 ..< 1000 { array.append(randomKeyByBitLength(Int(arc4random_uniform(8)))!) } DispatchQueue.main.async { self.collectionView.collectionViewLayout.invalidateLayout() } } Solution 2 (imperfect, see DHennessy13 improvement … Read more
How to remove constraints programmatically that is added from storyboard?
As @Henit mentioned, you can set IBOutlet for constraints as well. For example, @property(weak, nonatomic) IBOutlet NSLayoutConstraint *viewHeight; so now, you can remove this constraint like this: [myView removeConstraint: viewHeight]; Or else if you want to remove all / multiple constraints related to your view then, [myView removeConstraints: constraintsArrayHere]; // custom array of constraints references … Read more