Re: Constraints Question

2012-10-04 Thread Matt Neuburg
On Sat, 29 Sep 2012 17:52:23 -0400, Eric Gorr mail...@ericgorr.net said:
I am trying to wrap my head around the auto-layout functionality.

There are at least three (count them three) WWDC 2012 videos about this, and I 
strongly recommend that you touch *nothing* until you have watched all of them. 
m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
___

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


Constraints Question

2012-09-29 Thread Eric Gorr
I am trying to wrap my head around the auto-layout functionality.

I have a sample project at:

http://ericgorr.net/cocoadev/constraints.zip

After opening the project, take a look at ELGFirstViewController.xib. 

This app will only be used in landscape.

On this XIB, there are three objects.

(1) A button 
(2) A label
(3) A Table View

What I am looking to do is the following:

1. I want the table view to be a fixed height of 648 pixels. It should be the 
full width of it's superview and anchored at the bottom.
2. The label should be immediately above the table, with no vertical separation 
between it and the table view. It should also be the full width of the 
superview and it's height should remain fixed.
3. The button should be located at the right, with no vertical separation 
between it and the label. There should be no vertical separation between it and 
top of the super view. The height of the button is what I would like to be 
variable.

I have tried playing around with the height constraint of the button, lowering 
it's priority, but in every case, it is the height of the table view that 
shrinks.

How can I set up the constraints so the height of the button is variable? Is 
this possible to specify within IB or is the something I will need to do in 
code?



I can, of course, just fix the height of the button since I know how many 
pixels I will have remaining, but, again, I was interesting in learning 
something about auto-layout and was having trouble resolving this problem.


Thank you.




___

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: Constraints Question

2012-09-29 Thread Jonathan Hull
You probably want to set the content hugging priority of the button to a lower 
value (probably UILayoutPriorityDefaultLow).  By default, buttons have an 
intrinsic constraint that says they don't like to grow vertically (it likes to 
hug its content strongly in the vertical direction).

[myButton setContentHuggingPriority:UILayoutPriorityDefaultLow 
forAxis:UILayoutConstraintAxisVertical];

Thanks,
Jon

 
On Sep 29, 2012, at 2:52 PM, Eric Gorr mail...@ericgorr.net wrote:

 I am trying to wrap my head around the auto-layout functionality.
 
 I have a sample project at:
 
   http://ericgorr.net/cocoadev/constraints.zip
 
 After opening the project, take a look at ELGFirstViewController.xib. 
 
 This app will only be used in landscape.
 
 On this XIB, there are three objects.
 
 (1) A button 
 (2) A label
 (3) A Table View
 
 What I am looking to do is the following:
 
 1. I want the table view to be a fixed height of 648 pixels. It should be the 
 full width of it's superview and anchored at the bottom.
 2. The label should be immediately above the table, with no vertical 
 separation between it and the table view. It should also be the full width of 
 the superview and it's height should remain fixed.
 3. The button should be located at the right, with no vertical separation 
 between it and the label. There should be no vertical separation between it 
 and top of the super view. The height of the button is what I would like to 
 be variable.
 
 I have tried playing around with the height constraint of the button, 
 lowering it's priority, but in every case, it is the height of the table view 
 that shrinks.
 
 How can I set up the constraints so the height of the button is variable? Is 
 this possible to specify within IB or is the something I will need to do in 
 code?
 
 
 
 I can, of course, just fix the height of the button since I know how many 
 pixels I will have remaining, but, again, I was interesting in learning 
 something about auto-layout and was having trouble resolving this problem.
 
 
 Thank you.
 
 
 
 
 ___
 
 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/jhull%40gbis.com
 
 This email sent to jh...@gbis.com
 

___

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