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
2
votes
1 answer

iCarousel with auto layout

I´m using the iCarousel project in my universal app. I create the main interface in a xib file. The SBFGalleryView´s size will adjust depending if the app is running on iPad or iPhone. Due that, i add constrains to the iCarousel´s view so it…
DaSilva
  • 1,358
  • 1
  • 19
  • 42
2
votes
1 answer

iOS 8 CGAffineTransformMakeScale + autolayout not working any more

There seems to be a some post related to my problem but none seems to help. How do I adjust the anchor point of a CALayer, when Auto Layout is being used? I have a scaled preview of my app (as a tutorial), which the standard view (and…
Sunkas
  • 9,542
  • 6
  • 62
  • 102
2
votes
2 answers

Rotation with Autolayout not working

the below method is not called when i rotate my device with Autolayout ON in IB. willRotateToInterfaceOrientation:duration: Firstly does the above methods don't wok with autolayout? the method gets called with Autolayout turned off. I am trying to…
Irfanlone
  • 564
  • 7
  • 16
1
vote
1 answer

Autolayout Buttons not correct

Ipad Image Iphone Image I'm having trouble with auto layout with iPad buttons fitting like the buttons on the iPhone. Any suggestions?
Meg
  • 25
  • 4
1
vote
2 answers

UIStackView arrangedElement override alignment

I have a stackview in my iOS app with many arranged elements. For most of the elements, I want to center them vertically in my stack. However, for some elements, I want to visually tweak them by moving them a few units above or below the center…
Winston Du
  • 340
  • 2
  • 9
1
vote
1 answer

Change width constraint of a Button in StackView Programmatically

I have a stackView which contains some UItextfields and one button. I have constrained it in ViewController viewDidLoad like this: let stackView = UIStackView() stackView.axis = .vertical stackView.spacing = 40 stackView.distribution =…
user13370778
1
vote
1 answer

Constraints issue

I am having trouble with my constraints. Any ideas would be appreciated!! I have tried making a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints using the debugger to catch it, but I didn't know how to solve the problem. Here is the…
mick1996
  • 516
  • 9
  • 31
1
vote
1 answer

how to fit collection view cell in table view cell ( adaptive on all screen sizes?)

My collection view cells (7 cells) need to fit into table view cell, but when I run it it shows differently in iPhone 6 and iPhone X . Is there any way that I can overcome the issue? Let's say I have 2 collection views which should cover and fit…
letsCode
  • 31
  • 7
1
vote
3 answers

change heightAnchor of higher size then current size is not working

I have one view whose height is 50 myView.heightAnchor.constraint(equalToConstant: 50).isActive = true Now what I want to do is when I click button (buton1), I want to change its height to 20. So I make below and it's working…
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
1
vote
1 answer

Dynamic height of two UIView's in a ViewController

I have the following ViewController, with 3 UIViews and content inside. The red lines are my constraints. The black one has always a fixed height. The red UIView has a CollectionView inside, which will grow, depending on it's items. The green is a…
ProjektWeinheim
  • 201
  • 3
  • 10
1
vote
1 answer

Gradient from UIView after orientation transition

I have an extension for UIView to apply gradient: extension UIView { func applyGradient(colors: [CGColor]) { self.backgroundColor = nil let gradientLayer = CAGradientLayer() gradientLayer.frame = self.bounds //…
Wilhelm Lake
  • 65
  • 1
  • 6
1
vote
1 answer

How to add constraints to a view inside a subview of a StackView

In my test program there is a vertical stack view, in its third subview (the green one at the bottom) I want to add a red rectangle at its center. I tried anchoring to centerXAnchor, and centerXAnchor but it doesn't work. I suspect it's because the…
Thinium
  • 171
  • 1
  • 14
1
vote
2 answers

layout with before and after margins with equalToSystemSpacingAfter

I’m trying to change some layouts I have to a number-less layout. This is what I have for a segmented bar that should be inside a container view with something like this | - margin - segmented - margin…
Wak
  • 818
  • 2
  • 11
  • 18
1
vote
2 answers

Autolayout UITableViewCells covering up bottom

I'm having trouble with this UITableViewCell. I'm getting strings from a server and inserting it in viewDidLoad, but the bottom of the cell, namely summaryLabel is being covered up. Is it the inset? Here's the code: class SummaryTableViewCell:…
Yoomama
  • 133
  • 8
1
vote
4 answers

change font size in UILabel based on auto layout (swift)

I've got a UILabel placed inside a UINavigationBar. I want to increase the font size of that label based on the height of the navigationBar. When the navigationBar is large, I want the font size to be bigger, and when I scroll and the navigationBar…
WalterBeiter
  • 2,021
  • 3
  • 23
  • 48