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
9
votes
2 answers

Exclude navigation bar from iOS "safe area"

In my iOS app, I have views rendered beneath the navigation bar. This is because the navigation bar is hidden until the user taps the screen. The screenshots below illustrate my problem. The "X" button is rendered beneath the iPhone X's notch and…
cohenadair
  • 2,072
  • 1
  • 22
  • 38
8
votes
3 answers

ios 11 - UIButton inside UIBarButtonItem causes an autolayout error

I've a known issue with adding a UIButton into UIBarButtonItem. I've tried to add auto layout constraints as suggested in stackoveflow but I'm getting an error described as below. UIButton *sortButton = [UIButton…
aymeba
  • 934
  • 1
  • 11
  • 26
8
votes
1 answer

On iOS11, how to have UIToolbar to size all items to fit?

Up to iOS 10, an UIToolbar with flexible space bar buttom items between its items would automatically reduce the font so that all text get displayed on the screen. Sample below (iOS 10): Ever since XCode 9, when running iOS 11 on simulator my…
Rodrigo Lira
  • 1,489
  • 3
  • 14
  • 28
8
votes
2 answers

Notification (not method) when Auto layout Trait Collection changes?

Is there some kind of system wide notification when the Auto Layout Trait Collection changes in iOS 9+? I know the UIViewController method traitCollectionDidChange but I would like to handle the trait change in the App Delegate which does not have…
Andrei Herford
  • 17,570
  • 19
  • 91
  • 225
8
votes
1 answer

Variable height UITableViewCell expands after scrolling to end of list and rotating

UPDATE I know what is causing this strange breaking of layout. It is the setting of an Accessory (UITableViewCellAccessory). If I stop specifying an accessory the layout does not break. I have not added this as the answer because an answer would…
Pat Long - Munkii Yebee
  • 3,592
  • 2
  • 34
  • 68
8
votes
1 answer

MKMapkit constraint error when reopen project

I built a custom view controller. It has 1 tableview, 2 views and 1 map. When I set the constraints for this layout it works fine. I close project and reopen the map view out of the view controller. The width and height are 1000 points. If I set the…
trquoccuong
  • 2,857
  • 2
  • 20
  • 26
7
votes
1 answer

Using SnapKit to Aspect Ratio and less size

I am trying to create the constraints of this layout in SnapKit but I have difficulty setting the maximum size (lessThanOrEqual). let maxWidthContainer: CGFloat = 435 let maxHeightContainer: CGFloat = 600 containerView.snp.makeConstraints { …
rafaeldepaula
  • 168
  • 1
  • 1
  • 10
7
votes
2 answers

Using snapkit / autolayout with UIScrollView

I have an app that will have a scrollView contentView chart buttons other stuff I tried constraining it like shown below, but I am missing a constraint and I can't find out what I need. self.view.addSubview(self.scrollView) …
Peter S
  • 827
  • 1
  • 8
  • 24
7
votes
2 answers

How to make a view height grow depending on its child views contents

I have a parent view whose height has to be decided by its child content. How may I achieve this in storyboard without programatically changing it.
7
votes
2 answers

Autoresizing not working in iOS11 / XCode 9

It appears that the Autoresizing of views is no longer reliably working when building for iOS11 with XCode 9. The layout of several views end up with the positioning of controls as they are in the XIB, but the appropriate resizing has not happened.…
Jim Leask
  • 6,159
  • 5
  • 21
  • 31
7
votes
1 answer

How to solve: This application is modifying the autolayout engine from a background thread

This error is logged to the console when some part of the code is changing UI items from other threads than the main thread. But how can I find where it does this?
www.jensolsson.se
  • 3,023
  • 2
  • 35
  • 65
7
votes
1 answer

Launch screen storyboard for multiple devices and different orientations in iOS

My application supports all devices from 4 inch onwards in both orientations. iPhone - 5, 5S, 5C, 6, 6S, 6+, 6S+, SE iPad 4, iPad Air, iPad Air2, iPad Pro etc Using asset catalog for launch screen its working fine but in iPad Pro app displays…
Srivathsa
  • 606
  • 10
  • 34
7
votes
2 answers

Autolayout UIView Proportional height with Minimum height requirement

I've created one Tab bar bottom view with proportional height related to main superview. Whereas, tab bar bottom view height in 6+ -> 59, in 6 -> 53, in 5 -> 45 & in 4s -> 38. It's working proportionally fine. But what if I want this tab bar…
Kiran Jasvanee
  • 6,362
  • 1
  • 36
  • 52
7
votes
3 answers

How to add Constraint programmatically in objective c

I want to add constraint programmatically and I use below code to add TOP and LEFT constraint. NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem:label1 …
Crazy Developer
  • 3,464
  • 3
  • 28
  • 62
7
votes
1 answer

Using Auto Layout in UITableViewCell containing a UICollectionView with asynchronous image load

TL;DR: The height calculated by the autolayout engine when displaying the cell containing the collection view is always wrong the first time. Calling reloadData() on the table view fixes the issue but also makes the table view to jump and to be…
pommefrite
  • 819
  • 10
  • 12
1 2
3
69 70