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

Xcode 6 Constraints with button images

I am creating an app that have a dashboard with 11 images.. 1 is the background, 1 are the lines that divide the button and 9 are the button with images. I tried several times with the automatic constraints assignment but I also tried manually and I…
MarcoCarnevali
  • 671
  • 8
  • 23
4
votes
2 answers

Keep UITableView offset when inserting rows at the top with UITableViewAutomaticDimension

I have an UITableView with Autolayout in my app. I need insert some rows to my TableView after press LoadEarlier Button to index[0], but i want to stay on my last position of my TableView.(Load Earlier Like WhatsApp & ...). My problem is after…
Mo Farhand
  • 1,144
  • 8
  • 21
4
votes
2 answers

iOS TableView wrong indexPath when selecting cell with keyboard shown

I have tableView size set by AutoLayout (bottom to Bottom Layout Guide, top to another view and so on but first UISearchBar to Top Layout Guide): Controller with tableView: I need to change table offset when keyboard is shown so I have these two…
Libor Zapletal
  • 13,752
  • 20
  • 95
  • 182
4
votes
1 answer

At what point are a UIViewController's subviews definitely laid out initially?

I have many places in my code where I need to do stuff based upon the layout of the views in a UIViewController. For example, I have a view in a nib that I then capture in code and use to create a mask for another layer, but I need to wait until the…
jowie
  • 8,028
  • 8
  • 55
  • 94
4
votes
3 answers

Long delay before seeing video when AVPlayer created in exportAsynchronouslyWithCompletionHandler

When playing a video exported from a AVAssetExportSession, you hear audio long before seeing video. Audio plays right away, but video only appears after the recording loops several times (i.e., starts and finishes). In other words, you hear audio…
Crashalot
  • 33,605
  • 61
  • 269
  • 439
4
votes
0 answers

Xcode 6.4: Setting more than one size-class font constraint on UILabel causes loss of font information

I think that is the best wording of this (at least for the size class in question). I have a UILabel inside of a container view inside of my view controller in a UIStoryboard. It appears that when I add multiple constraints to a UILabel so as to…
4
votes
2 answers

Tie AutoLayout constraint to UITableView separator inset in custom cell?

I'm trying to figure out how to align a label in a custom UITableViewCell so that it starts exactly with the row separator using AutoLayout in Interface Builder (default insets). My problem is that the separator inset is different on the iPhone and…
Mark
  • 6,647
  • 1
  • 45
  • 88
4
votes
1 answer

Layout of UISearchBar in UITableView header messed up after rotation

I have a UITableView with a search bar inserted programatically into the table's headerView: override func viewDidLoad() { super.viewDidLoad() resultSearchController = UISearchController(searchResultsController: nil) …
TimD
  • 8,014
  • 2
  • 24
  • 34
4
votes
1 answer

Programmatically using constraints to center a UIIMageView

I'm working on an iOS project in which I need to programmatically use constraints for my views. I'm used to storyboards, but am using xibs for this particular project due to the nature of the project specification. I have a MainViewController, in…
narner
  • 2,908
  • 3
  • 26
  • 63
4
votes
1 answer

Fit a UIImageView to a UIImage

I have a UIImage View that is set up using AutoLayout and constraints. I fit the image to the Image View using self.selectPhoto.contentMode = UIViewContentModeScaleAspectFit; NSLayoutConstraint *topConstraint = [NSLayoutConstraint…
leenyburger
  • 1,198
  • 1
  • 11
  • 23
4
votes
1 answer

set superview height constraint according to subview height constraint

1) View A , view B , View C height & width are equal 2) View A height depends on Label1 & Label2 height 3) View B height depends on Label3 4) View c height depends on Label4 5) I want to take max height from View A, View B & View C but all are…
user2526811
  • 1,233
  • 4
  • 20
  • 54
4
votes
1 answer

Getting error when adding constraint

I'm trying to set a constraint on 2 views so that they touch each other like this: I tried setting constraints programmatically: [self addConstraint:[NSLayoutConstraint constraintsWithVisualFormat:@"[_firstView][_secondView]" options:0 metrics:nil…
Eric
  • 3,811
  • 5
  • 15
  • 18
4
votes
2 answers

Layout still needs update after calling NSTableRowView layout

I have two NSTableView's in my app and the user can drag and drop items from table A to table B. When dragging an item to table B Xcode gives me the following layout warning message: Layout still needs update after calling -[NSTableRowView layout].…
BadmintonCat
  • 9,416
  • 14
  • 78
  • 129
4
votes
3 answers

Move UIView when Keyboard appears with AutoLayout

I got an UIView which I'd like to move up/down whether the UIKeyboard appears or disappears. Unfortunately I can't get it to work. Prior to AutoLayout it was a no-brainer but since AutoLayout I have some trouble with this one. Here is what I have…
dehlen
  • 7,325
  • 4
  • 43
  • 71
4
votes
2 answers

IOS8 Autolayout with relative width / height

I need to autolayout a storyboard UIView with a single UIControl. The UIControl should be centered, needs to have a aspect ratio of 1:1 and should always use 90% of the superviews width or height depending on the device orientation without…
loop masta
  • 149
  • 11