Questions tagged [autolayout]

Auto Layout is a constraint-based, descriptive user interface layout system for OS X and iOS.

The Auto Layout system defines layout constraints for user interface elements. Constraints represent relationships between user interface elements such as “these views line up head to tail,” or “this button should move with this split view subview.” When laying out the user interface, a constraint satisfaction system arranges the elements in a way that most closely meets the constraints. Constraints are objects and can be established in storyboards and XIBs, exposed as outlets, and created or modified in code.

11052 questions
4
votes
2 answers

iOS Custom keyboard's frame shrinks 20 points if status bar increases during recording or phone call?

I have a problem with Keyboard Extension on iOS (real) device during recoding or phone call (iOS Simulator doesn't have red status bar). Because of the status bar increases 20 points, the custom keyboard also moves 20 points in Y-axis and decreases…
João Oliveira
  • 422
  • 3
  • 17
4
votes
1 answer

Parent UIView not resizing after constraint.constant on UILabel changed

UPDATE Now Solved The problem was that when I was updating the bottomConstraint I was setting the Constant to the bottom padding property. Sounds reasonable but of course the Constant should have been set to 0 - BottomPadding. That explains why the…
Pat Long - Munkii Yebee
  • 3,592
  • 2
  • 34
  • 68
4
votes
1 answer

Using auto layout in UITableviewCell

I am trying to use auto sizing UITableView cells in swift with snapKit! relevant flags set on the UITableView are as follows: self.rowHeight = UITableViewAutomaticDimension self.estimatedRowHeight = 70.0 I have a UITextField defined in my…
CWineland
  • 615
  • 7
  • 18
4
votes
3 answers

Horizontally Center UILabel + UIImageView inside UIView with Autolayout

First Problem: I have UIView that contains UILabel (dynamic text) + UIImage. I want them to be centered inside the UIView. Just like these images: The answer here is out of date and now we have stack view maybe it can make the task easier. Second…
iOSGeek
  • 5,115
  • 9
  • 46
  • 74
4
votes
1 answer

How to make an item full width in auto layout constraint?

I'm trying to make a button full width in ios 9 storyboards, and am trying to create a width auto constraint, but the width constraint only seems to take an exact static number. How do I make the item go full width. Additionally if I wanted say…
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
4
votes
3 answers

Dynamic height for table view cells with images asynchronous loaded

I have a custom cell with dynamic height inside a XIB file which shows a post with a message and an image. Because the image will be loaded asynchronously from my API the aspect ratio of the image will be send with the resource. Inside the…
Tobias
  • 4,523
  • 2
  • 20
  • 40
4
votes
1 answer

XCode 7 How to pin to superview and not toplayout guide

I'm using the solution from this post. Autolayout: Add constraint to superview and not Top Layout Guide? But in xcode 7, this option is no longer available. Is it moved somewhere? Or is there another way to pin to superview bypassing the…
Ted
  • 22,696
  • 11
  • 95
  • 109
4
votes
3 answers

Last line in label for cell wont appear with auto layout and dynamic cell height

I am having some serious trouble getting my multiline label to show all of its lines. Often, the last line of the label simply does not appear, but it is apparent that the dynamically calculated cell height has taken in to account that it should…
Mitchell
  • 333
  • 5
  • 20
4
votes
5 answers

Getting UIButton width before viewDidAppear, with AutoLayout

I have a UIButton (created in interface builder), that I'm turning into a circle by setting button.layer.borderRadius = button.frame.size.width / 2.0; (programatically, in viewDidAppear:). However, the viewController it belongs to is presented…
4
votes
0 answers

Why autolayout needs -20 for leading and trailing space on iOS?

I use storyboard and autolayout. I place a thin UIView inside a UIViewController's UIView (which gets pushed to a UINavigationController). Then I add constraint to make the thin UIView resize itself to keep x-margin = 0 and x-ending-margin = 0.…
frankish
  • 6,738
  • 9
  • 49
  • 100
4
votes
3 answers

Stop UITextField from expanding horizontally

I have a UITextField positioned in a view next to a button. It has a trailing constraint of 8 to the button (which has a trailing constraint of 8 to the superview) and when I type long text in it, it simply scrolls along, which is I want. However,…
Technicolor
  • 1,589
  • 2
  • 17
  • 31
4
votes
3 answers

Loading images asynchronously in UITableView with Autolayout

I have a UITableView which loads images asynchronously in a UITableView. As all the images are different heights, I set a height constraint according to the height of the image. This works fine when I use DataWithContentsOfUrl, however freezes the…
dblythy
  • 108
  • 1
  • 7
4
votes
3 answers

UIView to fill remaining space of parent view

My view has 2 subviews. A UITextView and a UIView. The views are dynamically (programmatically) created. Using AutoLayout. I would like UITextView to grow to the height of the text UIView to fill remaining of the space of the parent (see…
Prakash Raman
  • 13,319
  • 27
  • 82
  • 132
4
votes
4 answers

Why is there a gap between horizontal scrollview content?

I have setup a UIScrollView which contains two ViewController's. This is how my viewDidLoad looks like: override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. …
Adrian
  • 19,440
  • 34
  • 112
  • 219
4
votes
3 answers

Rounding Corners of UITextField in ViewDidLoad only affects the left corners

i am trying to round the top and the bottom border of two UITextField The result in ViewDidLoad() The result in ViewDidAppear The problem is ViewDidAppear makes the border changes after half a sec of loading the view which is not good in my…
Amr Mohamed
  • 2,290
  • 4
  • 20
  • 39