Questions tagged [ios-autolayout]

In iOS, Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views.

In iOS, Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views.

More info

1049 questions
1
vote
1 answer

setting textfield constraints to hold effective in screen sizes 4.5 in to 6.5 in

if I set fixed width it either appears too large for small screen (4.5 in) or too small for large screen (6.5 in) and is there any special way to ensure the constraints hold good in all constraints
pandu
  • 47
  • 10
1
vote
0 answers

iOS - UIbutton image constraints relations with other object

So I have the view below: I have the plus button with an image(vector) and I am trying to make the auto button to be as the same size(top and bottom) as the plus button, but as you can see the plus button hight change according to the auto…
ironRoei
  • 2,049
  • 24
  • 45
1
vote
1 answer

Swift 4.2 SafeAreaLayoutGuide frame is the same as view.frame on View Did Load

I'm using safearealayout guides, programmatically (i.e.) without storyboards. I want to access the safeAreaLayoutGuides, layoutFrame size within my app but don't know when to call it. If you call on viewDidLoad, the size returned is the same as the…
1
vote
1 answer

iOS ImageView and TextView inside scrollView

I want to create this layout in which the image is at the top and scrolls along with textview, textview itself should not be scrollable but should expand with the text so that ImageView and textView are together in a single scrollView. I'm not able…
ssDON_JOE
  • 33
  • 6
1
vote
1 answer

UILabel intrinsicContentSize crashes on iOS 12

I'm updating my app to iOS 12 and in my subclass of UILabel, I'm getting a crash when I call super.intrinsicContentSize Commenting out the code leads to a crash at layoutSubviews(), presumably the next time it would query intrinsicContentSize. I'm…
1
vote
2 answers

UIViewController layout changes

I have a UIViewController that has 4 subviews - left view, right view, bottom view and the center view. The center view actually embeds another view controller (AVPlayerViewController). On the press of a button, I wish to change the left view and…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
vote
2 answers

Animate subview AutoLayout constraint changes

Numerous tutorials on animating AutoLayout constraints suggest to update constant property of a constraint and then call layoutIfNeeded() in animation block. My situation is a bit tricky. I have a view that houses 3 subviews. The height of this…
1
vote
2 answers

Is there any way to get all the applied Auto-layout constrains programatically in Swift

I want to get the reference of all applied constraint using storyboard without any reference: I had tried many ways but could not able to find the exact solution: My Approach is as follows: if let constraint =…
Alok
  • 24,880
  • 6
  • 40
  • 67
1
vote
0 answers

Layout and constraint based drawing iOS with and without autolayout

Where can I find cleaner example and understanding of following methods. How they work, who call them and when ? and what is call stack. func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority:…
Nikunj Acharya
  • 767
  • 8
  • 19
1
vote
1 answer

How do I use a UIStackView in a non filling vertical capacity?

I want to stack varying height UIViews (each built in xibs) beneath the other (with a width that simply expands to meet the container) and I'm finding this hard probably because I don't understand it. My situation is relatively simple. I have a…
The Senator
  • 5,181
  • 2
  • 34
  • 49
1
vote
1 answer

Leading constraint is missing warning

I have a UITableViewCell and I put two subviews in it in the StoryBoard. I set constraints as follows: The first subview has the leading constraint set to 0 points and width equal to 0.45 of the content view. Height is equal to height of content…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
1
vote
0 answers

How to disable autolayout animations for a single view in iOS, Swift?

I need to disable animations for a specific view that gets animated because of its autolayout properties. I cannot use this: UIView.setAnimationsEnabled = false Because it breaks the animations of other views. This didn't work either: override…
Lio
  • 4,225
  • 4
  • 33
  • 40
1
vote
2 answers

rightAnchor constraint did not apply when added programmatically - swift

When I Added rightAnchor constraint, constant= 20 did not apply. In leftAnchor is ok override init(frame: CGRect) { super.init(frame: frame) addSubview(collectionView) collectionView.translatesAutoresizingMaskIntoConstraints = false …
1
vote
2 answers

How to give vertical spacing with multiplier to the first view of UIViewController

When I give vertical spacing to first view of viewController, only constant take effect but multiplier is not working with multiple devices. After setting first view, in all other views it works very well. So, please give me right answer. See below…
1
vote
1 answer

Setting UITableViewCell's layout programmatically using anchors

I am trying to create a custom UITableViewCell using auto layout's anchors. The cell should: Have two columns Have three rows The content of the "cells" should just be UILabel Should have height set dynamically based on height of its rows However,…
Peter G.
  • 7,816
  • 20
  • 80
  • 154