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
1 answer

how to set size UIView in auto layout programmatically swift?

I have made two UIView with Auto Layout using this code : class ViewController: UIViewController { var view_constraint_V:NSArray = [NSLayoutConstraint](); var originalValue:CGFloat = 0.0; var offsetValue:CGFloat = -100; override…
black tiger
  • 123
  • 1
  • 2
  • 7
4
votes
1 answer

Custom cell to display multiline label using UITableViewAutomaticDimension

Aim: To display a multiline label on a custom cell in a UITableView using autolayout and UITableViewAutomaticDimension. The cell should vary based on the text in each UILabel. What I have done: Used auto layout tableView.rowHeight =…
user1046037
  • 16,755
  • 12
  • 92
  • 138
4
votes
1 answer

Dynamically change aspect ratio of view controlled by autolayout

Problem In UI I have some view which content is stretchable but should conserve some aspect ratio. This aspect ratio changes during run-time and views layout should be updated when some property describing aspect ratio changes. I've exposed…
Marek R
  • 32,568
  • 6
  • 55
  • 140
4
votes
3 answers

How to create different constraints for iphone 5 and iphone 6

Is it possible to create a constraint specifically for iPhone 4s and 5s without affecting iPhone 6? Please see image above: The scrollview's height is with equal height with the content view. I changed the multiplier to make it 40% of the actual…
Richard
  • 316
  • 3
  • 12
4
votes
3 answers

Changing UILabel font size with AutoLayout

I'm working with Swift, IOS 8 and AutoLayout. I have a big label, size 40 on center of the screen. I want that on iPhone 5s- the size of label becomes like 34, and on iPad a bigger font size, like 50. How can I do this with AutoLayout?
Lücks
  • 3,806
  • 2
  • 40
  • 54
4
votes
2 answers

Responsive design template for ipad orientations

I need to customise a particular UI with different design template for landscape and portrait modes of an iPad application. Basically this screen should have an image ,a content area to hold a description about the topic, related items of that topic…
Nassif
  • 1,113
  • 2
  • 14
  • 34
4
votes
2 answers

iOS UITableViewCell contents move on first scroll

You can see on the gif below that on the first scroll of UITableView cell's content moves a tiny bit. You can barely see it, margins become 1 pixel wider.I've never encountered this before. It seems like there's some layout issue before the first…
NKorotkov
  • 3,591
  • 1
  • 24
  • 38
4
votes
2 answers

systemLayoutSizeFittingSize:UILayoutFittingCompressedSize doesn't compress

I have problems with auto layout and the UITableView header (tableHeaderView) in iOS 8.X e iOS7.x. The self.HeaderView is a XIB built using auto layout. It's used inside a scrollviewer followed by other views and the result is correct. Then I set…
Daniele
  • 143
  • 1
  • 14
4
votes
3 answers

How to move a UIView dynamically with auto layout applied?

I have a UISegmentedcontrol (with 2 segments), and a UIView. Due to the fact that the minimum number of segments is 2, I wan't to hide the segmentedcontrol and add a UILabel. This is what it looks like in the simulator: (The red is the…
Horray
  • 693
  • 10
  • 25
4
votes
1 answer

How to Uninstall a UIView programmatically

In Interface builder the power of size classes lets you install constraints or uninstall them. In code you can do something similar by toggling the active property. Interface Builder also lets you install or uninstall views. However, I would…
DerrickHo328
  • 4,664
  • 7
  • 29
  • 50
4
votes
2 answers

"Present as Popover" segues and view size

Can anyone point to any guidance/documentation on how items should be placed in a view controller that will be displayed as a popover so that the components are appropriately positioned with auto layout? Specifically: I'm working in Xcode 8.3 with…
Neil Coffey
  • 21,615
  • 7
  • 62
  • 83
4
votes
2 answers

iOS8 UITableView with autolayout has a blank space above cells

I've created a UIViewController in a storyboard using autolayout and it has an embedded UITableView. For some reason there is white space above the table view section. My expectation is that the tableview would split all available space into cells…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
4
votes
2 answers

Get frame of a view after autolayout

I have a method: - (void)underlineTextField:(UITextField *)tf { CGFloat x = tf.frame.origin.x-8; CGFloat y = tf.origin.y+tf.frame.size.height+1; CGFloat width = self.inputView.frame.size.width-16; UIView *line = [[UIView alloc]…
Halpo
  • 2,982
  • 3
  • 25
  • 54
4
votes
1 answer

Align first line of multiple lines UILabel with UIImage using AutoLayout programmatically ( Objective-C )

I'm trying to align a multi-lines UILabel with a UIImage. The thing is : I want to align the first line of this label with the image, horizontally. What I tried : 1 - align the image with the entire UILabel, so basically I still wanted to take the…
Randy
  • 4,335
  • 3
  • 30
  • 64
4
votes
2 answers

UIScrollView behaves differently when embedded in a navigation controller

In this view controller, I initialize a UIScrollView, add it to the hierarchy and add autolayout constraints in viewDidLoad, and add an image subview in viewDidLayoutSubviews. If I assign this to a free-standing view in Storyboard, it behaves as…