Re: Autolayout Freespace

2013-12-12 Thread Charles Srstka
On Dec 11, 2013, at 11:54 PM, Luther Baker lutherba...@gmail.com wrote:

 And just to clarify, if I need to do some manual calculation, would I be
 using frames, etc? Frame feels like such a dirty word in autolayout
 world; is there something else specific to autolayout (like intrinsic size
 - obviously not in this case) ...
 
 Also, if I need to do some manual calculation, would I do that in the
 view's layoutSubviews - and would I remove and create constraints in that
 method also - and then tell them to lay themselves out again from that
 method as well?

You could just create width constraints for your views in IB, and give your 
controller outlets to the constraints themselves. You could then adjust the 
constant property on the constraints in code. The documentation claims that 
this performs better than removing constraints and adding new ones.

Charles

___

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

Autolayout Freespace

2013-12-11 Thread Luther Baker
Is there a way autolayout can be told to proportionally divide available
free space amongst a set of views?

For example (please ignore the actual 'VFL' and consider the following
horizontal layout string as pseudo code):

H:|-[FirstName]-[LastName]-[SocialSecurity]-[Birthday]-[Age]-|

Assume that each control hugs its own content tightly and that in the
simple case, the initial display ends up requiring only 50% of the
available parent view width.

Can I set up the constraints so that the remaining space is divided up
according to some user-defined relative weighting mechanism? IE: I want the
FirstName and LastName textfields to grow - receiving 20% each of the
remaining space with the Birthday button then getting the final extra 10%?

Using resistance and hugging properties, I know how to make 1 control
receive all the extra space  ... but I don't know how to balance free space
across several controls.
___

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

Re: Autolayout Freespace

2013-12-11 Thread dangerwillrobinsondanger


Sent from my iPhone

 On 2013/12/12, at 13:50, Luther Baker lutherba...@gmail.com wrote:
 
 Is there a way autolayout can be told to proportionally divide available
 free space amongst a set of views?
 
 For example (please ignore the actual 'VFL' and consider the following
 horizontal layout string as pseudo code):
 
H:|-[FirstName]-[LastName]-[SocialSecurity]-[Birthday]-[Age]-|
 
 Assume that each control hugs its own content tightly and that in the
 simple case, the initial display ends up requiring only 50% of the
 available parent view width.
 
 Can I set up the constraints so that the remaining space is divided up
 according to some user-defined relative weighting mechanism? IE: I want the
 FirstName and LastName textfields to grow - receiving 20% each of the
 remaining space with the Birthday button then getting the final extra 10%?
 
 Using resistance and hugging properties, I know how to make 1 control
 receive all the extra space  ... but I don't know how to balance free space
 across several controls.
So this is where you might use long form. 
But basic thing is you need to calculate. Then set the metrics. Of course you 
might need to do some KVO or other means of keeping in sync with resizing. 

You might also just consider NSStackView designed for this purpose. 

 ___
 
 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/m

___

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

Re: Autolayout Freespace

2013-12-11 Thread Luther Baker
Thanks - and yeah, I'm trying to avoid calculation.

And just to clarify, if I need to do some manual calculation, would I be
using frames, etc? Frame feels like such a dirty word in autolayout
world; is there something else specific to autolayout (like intrinsic size
- obviously not in this case) ...

Also, if I need to do some manual calculation, would I do that in the
view's layoutSubviews - and would I remove and create constraints in that
method also - and then tell them to lay themselves out again from that
method as well?

Back to the original question, do I misunderstand priorities? Can these act
as weights at all ... or does the highest priority just win?

Thanks.



On Wed, Dec 11, 2013 at 11:28 PM, dangerwillrobinsondan...@gmail.comwrote:



 Sent from my iPhone

  On 2013/12/12, at 13:50, Luther Baker lutherba...@gmail.com wrote:
 
  Is there a way autolayout can be told to proportionally divide available
  free space amongst a set of views?
 
  For example (please ignore the actual 'VFL' and consider the following
  horizontal layout string as pseudo code):
 
 H:|-[FirstName]-[LastName]-[SocialSecurity]-[Birthday]-[Age]-|
 
  Assume that each control hugs its own content tightly and that in the
  simple case, the initial display ends up requiring only 50% of the
  available parent view width.
 
  Can I set up the constraints so that the remaining space is divided up
  according to some user-defined relative weighting mechanism? IE: I want
 the
  FirstName and LastName textfields to grow - receiving 20% each of the
  remaining space with the Birthday button then getting the final extra
 10%?
 
  Using resistance and hugging properties, I know how to make 1 control
  receive all the extra space  ... but I don't know how to balance free
 space
  across several controls.
 So this is where you might use long form.
 But basic thing is you need to calculate. Then set the metrics. Of course
 you might need to do some KVO or other means of keeping in sync with
 resizing.

 You might also just consider NSStackView designed for this purpose.

  ___
 
  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/m

___

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