All Questions

1274
votes
26answers
435617 views

Using Auto Layout in UITableView for dynamic cell layouts & variable row heights

How do you use Auto Layout within UITableViewCells in a table view to let each cell's content and subviews determine the row height (itself/automatically), while maintaining smooth scrolling performan...
758
votes
11answers
213566 views

How do I animate constraint changes?

I'm updating an old app with an AdBannerView and when there is no ad, it slides off screen. When there is an ad it slides on screen. Basic stuff. Old style, I set the frame in an animation block. New...
239
votes
11answers
209444 views

Swift | Adding constraints programmatically

I'm trying to figure this out since last week without going any step further. Ok, so I need to apply some constraints programmatically in Swift to a UIView using this code: var new_view:UIView! = UIV...
253
votes
27answers
111709 views

Evenly space multiple views within a container view

Auto Layout is making my life difficult. In theory, it was going to be really useful when I switched, but I seem to fight it all of the time. I've made a demo project to try to find help. Does anyone...
148
votes
11answers
50834 views

How do I adjust the anchor point of a CALayer, when Auto Layout is being used?

Note: Things have moved on since this question was asked; see here for a good recent overview. Before auto layout, you could change the anchor point of a view's layer without moving the view by sto...
210
votes
10answers
134542 views

When is layoutSubviews called?

I have a custom view that's not getting layoutSubview messages during animation. I have a view that fills the screen. It has a custom subview at the bottom of the screen that correctly resizes in Int...
218
votes
3answers
71335 views

What is "Constrain to margin" in Storyboard in Xcode 6

I am Working with autolayout and constraints and found there is a Constrain to margins option in XCode 6 which was not present in XCode 5 and is checked by default. I created a test project then I ad...
546
votes
7answers
167049 views

Cocoa Autolayout: content hugging vs content compression resistance priority

I can't find a clear answer on Apple documentation regarding Cocoa Autolayout about the difference between content hugging and compression resistance. Can somebody explain their usages and differenc...
143
votes
13answers
84774 views

UILabel sizeToFit doesn't work with autolayout ios6

How am I supposed to configure programmatically (and in which method) a UILabel whose height depends on its text? I've been trying to set it up using a combination of Storyboard and code, but to no a...
74
votes
4answers
79699 views

UIScrollView doesn't use autolayout constraints

I have a scroll view and an image view behind it and I am populating it with nibs. I am using autolayout. I have a bottom space to superview and a top space to superview on both of the views. The i...

Previous Next