All Questions
Tagged with autolayout cocoa-touch
270 questions
0
votes
1
answer
88
views
AutoLayout - equal heights based on taller view
This is conceptually similar to Autolayout height equal to MAX(multiple view heights) except that question is sizing a container view, but I am wanting both buttons to be sized to the height of the ...
1
vote
0
answers
52
views
Determine value for default layoutMargins
The system changes the layoutMargins of the main view, according to size classes
like for small iPhones it's left value is 16, for the X phones it's 20
Besides asking the view controllers for it's ...
3
votes
1
answer
1k
views
UITableViewCell height not dynamic when constrained to UIStackview containing multi-line UILabels
I have a tableview cell that contains a UIStackView. The stack view contains two labels that could be multiple lines and another stackview at the bottom. This is how the cell should appear, but with ...
1
vote
2
answers
39
views
Constrain text to a location, then have it dynamically move if required
I am making a UITableView with two labels. I have constrained the secondLabel to be +12 from the firstLabel, meaning it will move along if the firstLabel contains a lot of text. However, that means if ...
0
votes
1
answer
56
views
Why would an auto layout constraint be activated without setActive: being called?
I have a constraint in my app that I programmatically set to be inactive. However, when I pause the app shortly after setting it inactive, the debugger shows that it is active. If I set a breakpoint ...
0
votes
2
answers
21
views
How to keep fonts the same size across (where possible) different controls with autolayout?
I have several UILabels which span a different number of lines. I've set the font / size for each with different sizing classes. I've also set a minimum size.
However I can't keep fonts the same size....
1
vote
2
answers
3k
views
How to correctly determine keyboard and text field position on iOS?
I want to lift the view when the keyboard shows and the text field becomes invisible. Here is my code:
@objc func keyboardWillShow(notification: NSNotification) {
if let keyboardSize = (...
0
votes
1
answer
721
views
How can I space UITextField leading and training edges in a UIStackView?
I have two UITextFields in a vertical UIStackView. I want their leading and trailing edges to be 20 points away from the edge of the UIStackView. However I cannot figure how to do this without ...
8
votes
2
answers
3k
views
UIStackView: push subviews to the edges ("Unlimited" spacing)
I am using UIStackView to define a list's layout.
I am trying to achieve the effect similar to this:
||Item1---spacing---Item2||
So, the two items are being pushed to the sides of the UIStackView.
...
1
vote
2
answers
174
views
Autolayout with UIScrollView
I am using autolayout in Xcode and am creating a fairly tall (1300px) ViewController with a uiscrollview to navigate up and down. I made the viewcontroller freeform so its dimensions are [375,1300]. I ...
0
votes
1
answer
72
views
Making UILabels in a stack view hug each other
I am making a promo page in my app to make the user want to buy the PRO version of the app.
I am laying it out using a stack view, and I am trying to make the items spaced out well, which I have ...
2
votes
1
answer
1k
views
Xcode Safe Area Glitch With iPhone SE & 4s
I was setting up constraints when I realize things don't look right on iPhone SE and 4s. As shown below, the safe area is out of bounds. Any way to get around it so I can get an accurate look at my ...
0
votes
3
answers
72
views
Autolayout, several UILabels, lines in each, same font size?
I have a number of UILabels on a view and a varying amount of text in each. I need the font size to be the same in each.
I’m using autolayout to position / size the labels.
However some of the “g” ...
1
vote
1
answer
888
views
Enable safe areas programmatically
Is there a way to enable Safe Areas programmatically?
Context: The app i'm working on is stuck to iOS 7 as target, and that probably won't change for a while. Xcode won't accept Safe Areas enabled ...
1
vote
1
answer
50
views
How can I create a UITableViewCell with subview of set height using autolayout?
I have a table view cell (yellow) with one subview (red):
The subview should have a fixed height of 100. And should have a border of 5 top, and 5 bottom to the cell.
The table row needs to be dynamic:...