• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding Constraints in Code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Constraints in Code


  • Subject: Re: Adding Constraints in Code
  • From: Jonathan Hull <email@hidden>
  • Date: Mon, 14 Sep 2015 10:50:59 -0700

You shouldn’t have to add any constraints to the direct children of a StackView (and in fact, you will most likely get an error if you try), since the StackView will make its own constraints and manages them for you.

My guess is that the StackView is not resizing with the ScrollView.  You can test this by temporarily removing the detail view (and associated constraints) and setting the StackView’s background color to some bright color.

Constraints with ScrollViews are notoriously tricky…

Thanks,
Jon


> On Sep 14, 2015, at 8:48 AM, Dave <email@hidden> wrote:
>
>
>>
>> In fact, with NSStackView you should just be able to set the content hugging priority and it’ll just work
>>
>> myDetailView = [myDetailViewController getPrimaryView];
>> [self.pValidationListStackView addView:myDetailView inGravity:NSStackViewGravityTop]; // NOTE: Should this not be GravityLeading as you’re using a horizontal stack view?
>> [myDetailView setContentHuggingPriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal];
>>
>> and that’s all you should need.
>>
>> iain
>
> I tried that and it had no effect. When I resize the window the Scroll View Resizes (and I assume the StackView?) but the Detail View stays the same size - e.g. does not move with the right edge of the Scroll View.
>
> Cheers
> Dave
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Adding Constraints in Code
      • From: Dave <email@hidden>
References: 
 >Adding Constraints in Code (From: Dave <email@hidden>)
 >Re: Adding Constraints in Code (From: Iain Holmes <email@hidden>)
 >Re: Adding Constraints in Code (From: Iain Holmes <email@hidden>)
 >Re: Adding Constraints in Code (From: Dave <email@hidden>)

  • Prev by Date: Re: Adding Constraints in Code
  • Next by Date: Re: API to determine status of System Integrity Protection?
  • Previous by thread: Re: Adding Constraints in Code
  • Next by thread: Re: Adding Constraints in Code
  • Index(es):
    • Date
    • Thread