• 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
Auto Layout, NSScrollView and NSStackView - Adding View to StackView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Auto Layout, NSScrollView and NSStackView - Adding View to StackView


  • Subject: Auto Layout, NSScrollView and NSStackView - Adding View to StackView
  • From: Dave <email@hidden>
  • Date: Mon, 07 Sep 2015 20:40:27 +0100

Hi,

I almost have the desired effect for the Auto Layout, NSScrollView and NSStackView combination with everything setup in a NIB. There is one thing left I need to do - please see following code:

-(void) awakeFromNib
{
LTWDetailXView*			myDetailView;
NSInteger				myIndex;
NSInteger				myCount;
NSString*				myDescriptionInfo;

//**
//**	Set to 1 to Test Loading and Use of Detail View
//**
myIndex = 0;
myCount = 50;
do
	{
	myDetailView = [LTWDetailXView loadViewFromNIB];
	if (myDetailView == nil)
		{
		NSLog(@"Could Not Load LTWDetailView");
		return;
		}

	myDescriptionInfo = [[NSString alloc] initWithFormat:@"This is View Number %ld of the Stack View",myIndex];
	[myDetailView setDescriptionInfo:myDescriptionInfo];

	[self.pValidationListStackView addView:myDetailView inGravity:NSStackViewGravityTop];

	myIndex++;
	myCount--;
	} while (myCount > 0);
}


The ScrollView/StackView combo that myDetailView added to on the addView:inGravity call, is wider than the DetailView. What I’d like to happen is that the Detail is Stretched/Shrunk to match the width of the Scroll View/StackView. I think I need to add a horizontal constraint in code before I added the view. Is this correct?

If so, I’m assuming I need to add the constraint to myDetailView? If so which View do I constrain it to? NSScrollView, the FlippedClipView inside NSScrollView or the StackView or none of the above?

Thanks a lot for any help on this.
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


  • Follow-Ups:
    • Re: Auto Layout, NSScrollView and NSStackView - Adding View to StackView
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: "Computed segue" in iOS?
  • Next by Date: Re: Auto Layout, NSScrollView and NSStackView - Adding View to StackView
  • Previous by thread: Re: Problem with Auto Layout and drawRect
  • Next by thread: Re: Auto Layout, NSScrollView and NSStackView - Adding View to StackView
  • Index(es):
    • Date
    • Thread