Questions tagged [ios-autolayout]

In iOS, Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views.

In iOS, Auto Layout dynamically calculates the size and position of all the views in your view hierarchy, based on constraints placed on those views.

More info

1049 questions
2
votes
2 answers

equal distance from top layout guide and bottom layout guide

I am trying to position an element that has an equal distance from the top layout guide and the bottom layout guide. Is there a way to do this through the interface builder or programmatically? One solution I can think of is to just make another…
user3587412
  • 1,053
  • 1
  • 12
  • 13
2
votes
3 answers

Removing constraints that were added programatically

I read many topics about how to remove constraints that were added through the storyboard, drag outlet and then remove etc. but how I can remove constraints that were added programmatically? For example firstView.topAnchor.constraints(equalTo:…
Sargot
  • 73
  • 2
  • 6
2
votes
1 answer

UIScrollView how do you constrain a sub view that acts a container to all the other views?

so as you will see below I have a scrollview and I want to add it the the UIViewControllers root view. When I have it constrained to the top, right, bottom, and left I expect to see the red color take up the whole screen. This obviously works, but I…
user3832583
  • 371
  • 4
  • 19
2
votes
1 answer

Manage automatic header height with dynamic label width in UITableView

I want to create a UITableView header with dynamic height. I have four labels in the view and the height of the header must be adjusted according to the content in each of the UILabels. I want to achieve something similar to this image. Sample…
2
votes
2 answers

ForeceFully set view height to zero

I have a view which has many subview. Height of view is depend upon height of subViews.But in a case I want view to be of height 0 regardless of its subView height. I to achieve that. for example there is a view called view and it has 2…
Aashish Nagar
  • 1,207
  • 1
  • 14
  • 30
2
votes
1 answer

How to constraint a UILabel between two neighbors with truncation?

I've got a UILabel with variable length content, when the content is long I want the text to be truncated. This part works: However if the text is short then this is how it appears: I don't understand why the start of the text is shifted to the…
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378
2
votes
2 answers

how can I add auto layout constraints for a line programatically

I drew a line programatically in y UI. How can I add constraints for this line. let line = UIView(frame: CGRect(x: 10, y: 350, width: 350, height: 1)) line.backgroundColor = UIColor.white;self.view.addSubview(line)
faheem
  • 83
  • 12
2
votes
1 answer

autolayout constraint not working

I want to implement scrollview (Horizontal scroll)with paging and one of the page also contains another scrollview (Vertical scrollview) but elements in scrollview not follow autolayout constraints.Please suggest me way to implement it. Here also…
2
votes
1 answer

How to increase the font size in propotion to view height

I am increase Textview height in propotion to parent view but font size remains same. I would like to change the font size accoring to textview or screen size so it fills up the space in textview The problem I am facing is in iPhone 4s it fills up…
Shiva
  • 545
  • 1
  • 10
  • 41
2
votes
1 answer

iOS Swift3 Move a Textfield and a ContainerView with the keyboard

I need help to make my chat ViewController behave like Whatsapp does when you open and close your keyboard. That means: If the keyboard is opened, the view moves up. If it is closed, it returns to the original position. What I already have: My chat…
Jochen Österreicher
  • 683
  • 2
  • 11
  • 25
2
votes
2 answers

How to make distance between two views variable in autolayout

I have a view which is 50 px down from the top layout. I want the distance to vary based on the device size for example it should become 30 px in 4s while it should become 50px in iphone se while 60 in iPhone 6s. I tried giving aspect ratio instead…
Shiva
  • 545
  • 1
  • 10
  • 41
2
votes
0 answers

Breakpoint for "Modifying Layout Engine From Background Thread"

I'm getting the dreaded warning: This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes. I know what it means (it…
Nicolas Miari
  • 16,006
  • 8
  • 81
  • 189
2
votes
2 answers

UITableViewCell Constraints Not Updated

I have a custom UITableViewCell with UITextView, UICollectionView and UITableView inside. They have a 10 px space between. In some cases I have only UITextView, sometimes only collection view etc. When no text - I have to move UICollection view up…
Artem Z.
  • 1,243
  • 2
  • 14
  • 36
2
votes
1 answer

Auto Layout broken on iOS 8.1

I'm working with Auto Layout Visual Format Language and using the following expressions: H:|[_tableView]| H:|[_actionButton]| V:|[_tableView][_actionButton(==buttonHeight)]| They work fine in 9 and 10, but in iOS 8.1 we noticed that the layout is…
2
votes
2 answers

UITableView with self sizing cells becomes jerky when calling deleteRowsAtIndexPaths

I have a UITableView with self sizing cells. Table contains 1 section and some rows. I have some rows say 30 and I want to delete row during didSelectRowAtIndexPath. When I delete a row available near the bottom of tableview (say 28th row ), the…