> On 14 Sep 2015, at 17:39, Thomas Wetmore <t...@verizon.net> wrote:
> 
> 
>> On Sep 14, 2015, at 11:54 AM, Dave <d...@looktowindward.com> wrote:
>> 
>> I tred this:
>> 
>>      myDetailView = [myDetailViewController getPrimaryView];
>>      [self.pValidationListStackView addView:myDetailView 
>> inGravity:NSStackViewGravityTop];
>> 
>>      myConstraintsViewDictionary = [[NSMutableDictionary alloc] init];
>>      [myConstraintsViewDictionary setObject:self.pValidationListStackView 
>> forKey:@"StackView”];
>>      [myConstraintsViewDictionary setObject:myDetailView 
>> forKey:@"DetailView”];
>> 
>>      myConstraintsArray = [NSLayoutConstraint 
>> constraintsWithVisualFormat:@"H:|[DetailView]|" options:0 metrics:nil 
>> views:myConstraintsViewDictionary];
>>      [myDetailView addConstraints:myConstraintsArray];
>> 
>> I assumeI don’t need to add StackView to the Dictionary but it won’t do any 
>> harm?
>> 
>> When I run the above I get this error:
>> 
>> Unable to install constraint on view.  Does the constraint reference 
>> something from outside the subtree of the view?  That’s illegal. 
>> constraint:<NSLayoutConstraint:0x610000083de0 H:|-(0)-[LTWDetailXView]   
>> (Names: LTWDetailXView:0x608000181930, 
>> '|':NSStackViewContainer:0x6300001a0540 )> view:<LTWDetailXView: 
>> 0x608000181930>
> 
> The error message is saying that either your detail view or its container 
> view are not within the view tree of the receiver’s or any of the receiver’s 
> ancestors’ view trees. You need to figure out whether that is or is not true. 
> I tend to believe error messages until they are proven wrong. They are my 
> friends.
> 

If you look at the code, I’ve just added the DetailView to the StackView, so by 
definition DetailView is a Subview of StackView isn’t it?

>> Any idea what could be wrong?
> 
> Yes — I would believe the error message and assume that the constraint 
> references something from outside the subtree of the view. This would mean 
> that, at the point you are trying to add the constraints, either you haven’t 
> built the full view structure yet, or the structure you have built isn’t what 
> you think it is.

The structure was in my OP:

NSScrollView                                            Setup in NIB
        NSFlippedClipView                               Setup in NIB
                NSStackView                             Setup in NIB
                        LTWDetailXView          (added dynamically in code).

Cheers
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