> On 7 Jul 2016, at 04:37, Daniel Stenmark <dstenm...@opentable.com> wrote:
> 
> What’s the best way to achieve variable spacing between children of a 
> UIStackView?  I know that a popular approach is to add an empty dummy view to 
> act as padding, but this is being used in a UITableView cell, so scrolling 
> performance is critical and the implicit constraints created by adding a 
> ‘padding’ view are a death knell for us.  
> 
> Dan


There’s no trick way to do it, you need some extra view one way or another. 

It’s a bit surprising that adding extra, fixed sized children to the stack 
really adds that much overhead, that’s a few very simple constraints, all 
constant, and shouldn’t really make that much difference. Perhaps the stackview 
is being inefficient with the number of constraints it adds when you add an 
extra child. You could take a look at the view hierarchy and see if that’s the 
case or not. 

You could try going the other way around and making your real elements children 
of dummy views so you get to add the simplest top/bottom-padding constraints 
possible to those views, that may minimise the number of extra constraints 
added and you get to control it somewhat. But if your hierarchy is such that 
it’s straining the constraint system performance wise, whatever way you try to 
do this is going to have similar performance. 
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to