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
3
votes
0 answers

iOS 10 disable autorotation

iOS 10 with Autolayout and Size classes is giving nightmares for trivial issues that were easy before. I launch my app in Landscape mode and want to disable autorotation till everything is configured, after which I manually trigger autorotation…
3
votes
1 answer

NSLayoutConstraint re-activates by itself

I created a strong constraint for a UILabel in a .xib file and an outlet for it. In my code, I set self.constraint.active = NO, but after the application loads, when I open the Debug View Hierarchy, the same constraint is active. I tried setting it…
Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113
3
votes
1 answer

Swift NSAutoresizingMaskLayoutConstraint on a UICollectionViewCell gives warning but layout works fine

I am using a UICollectionVewCell with custom layout in which height of the different cell varies from cell to cell. I have used approach described here https://www.raywenderlich.com/107439/uicollectionview-custom-layout-tutorial-pinterest I have…
3
votes
2 answers

UIStackview fill proportionally in a UITableviewCell takes incorrect frame

Adding proportional fill setting in a UIStackview won't let the view stretch properly. Is this the expected behaviour?
nr5
  • 4,228
  • 8
  • 42
  • 82
3
votes
2 answers

How to position top in iOS swift?

I try to add a material swift card to the top of my view, but it always is shown too high. To set the height of the card fixes the problem but i don't want to set the height. Here is what it looks like. Here is a link to an image which shows how…
3
votes
1 answer

iOS Autolayout for scrollview and sticky footer

Assume I have a layout as on image below: Root view - is a viewController's view. I'd like to have my footer text to be sticked to bottom of screen, if content fits in one screen (main text is small) have 15pt from main text & 15 pt from bottom of…
user2786037
  • 495
  • 1
  • 12
  • 27
3
votes
1 answer

iOS Autolayout: two views of equal width and equally spaced

I am currently having difficulty with AutoLayout. I am using interface builder and am trying to place two uiview blocks of 100 * 100. I need these blocks placed in such a way that 1st block's leading to superview equals to 2nd block's trailing to…
khanHussain
  • 97
  • 1
  • 8
3
votes
4 answers

How to enable autolayout in storyboard Xcode 8

I'm trying to enable autolayout by clicking on 'Use Auto Layout' on following option in storyboard but after a while, it just appears a lock on screen indicating it is not possible, and checkbox is never selected how to enable it properly?
Jesús Ayala
  • 2,743
  • 3
  • 32
  • 48
3
votes
1 answer

Autolayout not animating in iOS 10 but working fine in iOS 9

- (IBAction)btnA:(id)sender { if(self.height.constant == 300) { self.height.constant = 50; } else { self.height.constant = 300; } [self.subView1 setNeedsUpdateConstraints]; [UIView animateWithDuration:1.0…
S.J
  • 3,063
  • 3
  • 33
  • 66
3
votes
1 answer

UISearchBar ignores programmatic constraints

I'm trying to build a ViewController subclass that leverages a UISearchController to display results. The view has an input field that I want to animate up to the top of the screen so the user has a maximum amount of room to view the results. I…
3
votes
3 answers

resizableImageWithCapInsets: issues

I try to figure out how to fit dropdown image into black border (border just for cenvenience) in UIImageView using resizableImageWithCapInsets:. I use AutoLayout, _imageView has fixed height constraint UIImage *dropdown = [[UIImage…
schmidt9
  • 4,436
  • 1
  • 26
  • 32
3
votes
1 answer

Auto set height of container view based on subviews

I know this question has been asked numerous times, but I can't quite seem to get to the bottom of this problem. Using Auto Layout, I would like to automatically set the height of my container UIView based on its subviews. I have looked at using…
Jody Heavener
  • 2,704
  • 5
  • 41
  • 70
3
votes
2 answers

How to evenly space two subviews around the center of UIStackView (iOS 9)?

How to evenly space two subviews around the centre of UIStackView in the vertical axis? Currently both labels are next to the top and the bottom of the StackView. The stack view is the greyed area on the simulator screen shot. How to make them…
Tomasz Nazarenko
  • 1,064
  • 13
  • 31
3
votes
1 answer

Trying to `viewDidLoad-Embed` a UINavigationController subclass in a Container View using AutoLayout

TARGET: To achieve this. APPROACH: Read about Container Views Found RKSwipeBetweenViewControllers Thought of blending both in to one GLITCH: The aforementioned Third Party (RKSwipeBetweenViewControllers) is basically a child of…
N a y y a r
  • 339
  • 1
  • 6
  • 18
3
votes
3 answers

keep 3 UIbuttons center aligned using autolayout

I have a UIView with 3 UIButtons and what I want is when I hide one button I want other two buttons to centrally aligned with equal margin. Let say if there are 3 buttons the UI should be Like If there are 3 buttons --------------- [ ][ ][ …
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256