Re: Autolayout fixed size centering in VFL

2013-10-07 Thread Luther Baker
Bringing this back up again ... Also, I suspect the reason you're specifying center-X alignment when creating the vertical constraints is because NSLayoutConstraint threw an exception when you tried to use the center-Y alignment option. That should be warning enough. ;-) Ignoring the larger

Autolayout fixed size centering in VFL

2013-10-04 Thread jonathan
I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? My best shot at it follows, but it is incorrect: [self.window.contentView addConstraints:[NSLayoutConstraint

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread Kyle Sluder
On Fri, Oct 4, 2013, at 01:31 PM, jonat...@mugginsoft.com wrote: I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? No. But it's still really simple to do in code. To achieve the desired

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread Kyle Sluder
On Fri, Oct 4, 2013, at 01:52 PM, Kyle Sluder wrote: The width and height of the view are independent of its position. Correctly specifying the view's size is a separate issue. Typically that is done by virtue of the constraints installed _within_ the view. (In other words, split up the

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread jonat...@mugginsoft.com
On 4 Oct 2013, at 21:52, Kyle Sluder k...@ksluder.com wrote: On Fri, Oct 4, 2013, at 01:31 PM, jonat...@mugginsoft.com wrote: I have a fixed size custom OS X view that I load from a nib and want to centre within a host view using auto layout. Can this be done using VFL alone? No. Thanks

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread Luther Baker
First of all ... very much appreciate you both so often! Thanks for commenting as much as you do. I too faced this issue and, like Kyle, read enough to assume it was generally not possible with VFL. But this afternoon, I came across this: https://github.com/evgenyneu/center-vfl and for my

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread Luther Baker
Sorry, I just noticed the link in the original question that contains the answer I was referring to. Now I'm curious to know if that doesn't work on the desktop or if you need to describe more than those simple two lines for other types of content/child views. I'm sure the UIImageView I am using

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread Kyle Sluder
On Fri, Oct 4, 2013, at 08:22 PM, Luther Baker wrote: First of all ... very much appreciate you both so often! Thanks for commenting as much as you do. I too faced this issue and, like Kyle, read enough to assume it was generally not possible with VFL. But this afternoon, I came across this:

Re: Autolayout fixed size centering in VFL

2013-10-04 Thread Luther Baker
Also, I suspect the reason you're specifying center-X alignment when creating the vertical constraints is because NSLayoutConstraint threw an exception when you tried to use the center-Y alignment option. That should be warning enough. ;-) This is true - as I typed this block into my own project