Hi All,

> On 7 Sep 2015, at 22:12, Ken Thomases <k...@codeweavers.com 
> <mailto:k...@codeweavers.com>> wrote:
> 
> On Sep 7, 2015, at 3:14 PM, Dave <d...@looktowindward.com 
> <mailto:d...@looktowindward.com>> wrote:
> 
>> Thanks a lot for this.
> 
> You're welcome.

There is so little info I can find on how to do this any help is really 
appreciated.

>>> You should set leading and trailing constraints between the stack view and 
>>> the clip view so that the stack view is as wide as the clip view.
> 
>> Horizontal Space  StackView.Trailing   Equal FlippedClipView.Trailing    -1, 
>> 1000, 1                 *****Constant = -1
>> Vertical Space      StackView.Top        Equal FlippedClipView.top          
>> 0, 1000, 1
>> Horizontal Space  StackView.Leading  Equal FlippedClipView.Leading  0, 1000, 
>> 1
>> 
>> Is this correct or do I need to change or add something? 
> 
> I would say the trailing constraint would be better with constant 0.  I'm not 
> sure why it's -1.  Either way, though, the difference will be slight and can 
> be changed later if you find a cause to without disrupting anything else.

It got set to -1 by XCode/IB when I did “Reset to Suggested Constraints” so I 
assumed it would be right although I’ve no clue why it should choose -1 as the 
value? Also, if I change it to zero I get IB warnings.

So given the above constraints, is this right if I want the Detail View to 
Stretch/Shrink in line with Scroll View/StackView? I realise I have to tweak 
the priorities in the DetailView but I’m trying to establish if the above is 
right were I to somehow Devine the right set of priorities for DetailView?

If so, then I need to tweak things in the LTWDetailView in order to make it 
Stretch/Shrink in the X direction?

After thinking about what I am trying to do here, I’m wondering if it’s 
possible using a NSScrollView/NSStackView combo - call it the 
“ScrollingStackView” to save my fingers.

Here’s the way I way thinking about things, I’d be grateful if someone could 
tell me if it’s possible using Auto Layout or suggested a better way of going 
about things.

1.  There are one or more Windows that have one or more of these 
ScrollingStackView's in their NIB files. Initially the Window is sized sensibly 
and the ScrollingStackView’s positioned sensibly with the Window.

2.  There are one or more DetailView’s, these DetailView's are stored in 
separate NIB files (e.g. LTWDetailXView, LTWDetailYView) and loaded when needed 
by code. The Detail Views are constructed in XCode/IB and are at their smallest 
most compact size (e.g. I don’t want them to get any smaller).

3.  I add these DetailView’s to the ScrollingStackView, when a view is added 
I’m like the following to happen:

If the width of the ScrollingStackView is smaller than the width of the 
DetailView, then I want the ScrollingStackView to expand to fit the DetailView. 
If the width of the ScrollingStackView is greater than the width of DetailView 
then I want the DetailView to expand to fit the ScrollingStackView. After that 
I want it to change with the 

Is this possible to do  using auto layout in XCode 6.4? 

I’ve been experimenting changing priorities in the DetailView to try and figure 
out how to do the above, but it’s really frustrating because quite often, 
changing one of the priorities cause the while view to disintegrate and give 
many IB errors and warnings and it’s difficult to put everything back together 
again. Also there doesn’t seem to be an “undo” for the Priority Values which 
makes it even harder to get it right and much easier to screw something up. 
I’ve had to revert the NIB file a good few times now when things have got to 
state where it’s completely Beswicked and the only way out is the dreaded 
“Clear All Constraints” command and even that sometimes still leaves things 
totally screwed up.

This is the View Hierarchy of the DetailView:

LTWDetailXView                                                  (Class 
LTWDetailXView)
        DetailMainView                                          (Class 
LTWDrawFrameView)
                DetailControlsView                                      (Class 
NSView)
                        DetailDescriptionTextField              (Class 
NSTextField)
                                DetailButtonStackView           (Class 
NSStackView)
                                        DetailButton1                   (Class 
NSButton)
                                        DetailButton2                   (Class 
NSButton)
                                        DetailButton3                   (Class 
NSButton)

I’m not sure if you can see the Screen Dump sent in a separate message?

If not then the layout is really simple. one DetailDescriptionTextField on the 
Left and one Vertical Stack View containing 3 buttons to the right of this. I 
want the DetailButtonStackView to move to the right and the 
DetailDescriptionTextField to Expand towards the DetailButtonStackView.

I did a “Clear Constraints” and then a “Reset to Suggested Constraints”, this 
placed a width constraint on DetailDescriptionTextField, in order to make it 
Stretch in X, I added a Height Constraint and removed the Width constraint that 
XCode/IB generated. This had no effect, so I then changed Content Hugging to 
H=240 and the Content Compression Resistance t  H=760 and low and behold the 
text field stretches out in X to fill the Frame of the Details View and doesn’t 
get any smaller - so far so good!

I now want to have the same happen with LTWDetailXView in relation to the 
ScrollingStackView, so I tried doing the same thing to the CHP and the CCRP on 
LTWDetailXView and DetailMainView but this did nothing? Why is this? Surely it 
should have the same effect or is the ScrollingStackView doing something to 
prevent this?

Any idea what need to do in order to make this happen?

Thanks again to everyone for the help.
All the Best
Dave









_______________________________________________

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