Auto-Layout Again
Auto-Layout Again
- Subject: Auto-Layout Again
- From: Dave <email@hidden>
- Date: Thu, 27 Aug 2015 14:41:39 +0100
Hi,
I’m still trying to get my head around Auto-Layout and how to set it up in XCode.
I’m trying to setup a StackView inside a ScrollView, I’ve based by code on the InfoBarView and the TSInfoBarView sample Apps. Basically I have the following elements:
LTWDetailWindowController This is the main Window Controller, the Window it controls is NOT resizable and has a size of 846 x 594.
This is set up like so (in XCode):
Objects
OtherViewController This has a outlet “disclosedView” which is hooked up to the Detail View In the VCs (see below).
DetailWindow
View
WindowHeaderView
ImageView
TextView -Setup with string data from Dictionary
DetailScrollView (NSScrollView)
Flipped Clip View
View
Scroller
Scalar
Button1
Button2
DetailView
TextView1 -Setup with string data from Dictionary
Left Button
Right Button
DisclosureViewController - This is a base class and has a NIB file which contains a single view representing the Header of the View to be added to a StackView. When the Disclosure button is clicked I want the
This is set up like so (in XCode):
Custom View
DetailHeaderView
Disclosure Button -When clicks shows/hides DetailView
Text View -Setup with string data from Dictionary
I want all this to work like this:
The LTWDetailWindowController get instantiated, it gets an Array of Dictionaries from the Data Model. For each dictionary in the Array I want to add a OtherViewController instance to the StackView and then add the StackView to the DetailScrollView. When this happens I want the StackView and whatever it contains to auto-magically resize to fit the DetailScrollView Container Size.
Firstly, is this possible using Auto-Layout and XCode/IB?
If so how do I go about doing it? I’m having all kind of problems in XCode trying to do what I think is the right thing to do. I have everything setup as above without any constraints and now want to add them.
I decided to start at the top level (maybe a mistake), so I select the DetailView in the Window Controllers NIB and then click the Add New Constraints button at the bottom of the NIB window but I can’t select anything in the popup? The same is true for the Alignment. Why is this? My confusion is that surely I need to somehow tell it that DetailView that it needs to change size to fit it’s superview?
Is there an easier way to do this or is there something that is more like what I want that shows how to do this?
I’m on the verge of forgetting about using Auto-Layout and going back to the old way of doing things which is so much easier.
It looks like Auto-Layout is another one of these things that is supposed to save you time but actually doesn’t save any time at all, in fact actually takes longer. I really don’t know what was so bad about the old way of doing things…..
Any help greatly appreciated, but understand fully that what I have described is pretty complicated and I’m unlikely to get this solved by help from the list.
All the Best
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