Auto Layout, NSScrollView and NSStackView - Adding View to StackView
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