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

Evenly spread buttons horizontally across screen using autolayout. Not equal spacing between them

I need to layout a series of buttons horizontally across the screen so that they're equally spaced across the screen, not equally spaced between themselves. An example is having 3 buttons there they are evenly spaced so that the first button is…
David
  • 2,770
  • 5
  • 35
  • 43
4
votes
3 answers

How to adjust the height of the header of a tableview in swift?

I have a UITableViewController. This table view has an header view. I use main.storyboard with autolayout to set my controller. In my main.storyboard, for w:Any h:Any, the preview of my view controller is set with the default size 600x600. Inside,…
cmii
  • 3,556
  • 8
  • 38
  • 69
4
votes
1 answer

Misplaced view warning and odd behavior with IB_DESIGNABLE custom view using auto layout

I create a custom IB-designable view (see code below) which renders correctly in IB and also works fine when running it. However, in get this warning about the view being misplaced and I cannot manually resize the view in Interface Builder (when…
Michael
  • 250
  • 3
  • 8
4
votes
1 answer

Update constraints for supplementary view of UICollectionView on orientation change

I'm using a header (supplementary view) in my UICollectionView. On the header I have label which has a certain distance from the left side. I'm doing my calculation and setting the constant of a constraint. Everything does work as expected. If the…
testing
  • 19,681
  • 50
  • 236
  • 417
4
votes
4 answers

UINavigationBar overlaps UITableView when programmatically setting prompt

I have a UINavigationController which contains a UITableViewController. This navigation controller pushes other UITableViewControllers around and eventually these table view controllers will have a prompt. The problem is when I set this prompt…
4
votes
0 answers

iOS 8 Dynamic Self Sizing UITableViewCell with UILabel

I've scoured through all of the questions here regarding a similar issue and I still seem to have this problem no matter what I do. I'm on iOS 8.3. You can find the full code at: https://github.com/DanielRakh/CellHeightTest.git I have a cell that…
DanielRak
  • 239
  • 1
  • 2
  • 11
4
votes
1 answer

NSLayoutConstraint constant standard value from code

In a storyboard you can set a constraint's constant property to be the standard value. Is there a way to do this from the code?
Tomasz Bąk
  • 6,124
  • 3
  • 34
  • 48
4
votes
2 answers

Force a specific Size Class on a view

I have a view that needs different constraints between the iPad & iPhone version. The login screen is presented as full screen on iPhone & in a page sheet on the iPad. Due to size the UITextFields are 40 pixels away from the right and left sides on…
4
votes
1 answer

AutoLayout breaking when displaying a view controller again

I'm trying autolayout with textview and it works perfectly fine when the view is loaded but when I go to another viewcontroller and come back to this viewcontroller what I see is all the autolayout is lost, here are the screenshots. This is what it…
Ankit
  • 280
  • 2
  • 17
4
votes
1 answer

CALayer is not positioned correctly within the View

Context I am using this simple library to make an intro/walkthrough for my app (TL;DR, horizontal paging view controllers). I currently have 3 pages setup. In the 3rd walkthrough page, I have a custom CALayer that animates a circle in an endless…
camdub
  • 867
  • 1
  • 10
  • 22
4
votes
1 answer

Autolayout detect when UIView got the frame

I have UIView that has auto layout constraints. I create it with frame CGRectZero. So I don't the real size. It will depend on superview. But I want to know when my view get a frame that I can use for my calculation.
Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277
4
votes
1 answer

make change UILabel text not trigger auto layout

I have a view controller in storyboard, and combining UILabel and ui collection view together in the controller. However every time I change the UILabel text, it will trigger auto layout, which shows I got view will layout and view did layout…
Wingzero
  • 9,644
  • 10
  • 39
  • 80
4
votes
1 answer

iOS Today Extension Mystery Height

I'm currently working on an iOS Today Extension and I'm having an issue with the extensions height. I've tried from scratch multiple times and I can't seem to figure out where the extra height is coming from. Where am I going wrong with AutoLayout.…
Shawn H.
  • 749
  • 1
  • 9
  • 22
4
votes
4 answers

flexible width for UITextField in auto layout

I've recently enabled Auto Layout in my client's app and am trying to update the program to take advantage of the iPhone 6 and 6 Plus larger screen sizes. However, I cannot get my view widths to adjust accordingly. At the moment, I'm just concerned…
Casey Perkins
  • 1,853
  • 2
  • 23
  • 41
4
votes
4 answers

Xcode autolayout: keep minimum between height and width of square

I used fixed aspect ratio for UIView so it's square. Then I set fixed trailing and leading space to borders of the screen they are the same. And kept vertical centered position. So in result I've got square on the center of the screen with some…
famer
  • 469
  • 1
  • 5
  • 14
1 2 3
99
100