Re: Auto layout and Scroll View Problems?
Re: Auto layout and Scroll View Problems?
- Subject: Re: Auto layout and Scroll View Problems?
- From: Dave <email@hidden>
- Date: Thu, 03 Sep 2015 17:34:23 +0100
On 3 Sep 2015, at 16:02, Kyle Sluder <email@hidden> wrote:
On Thu, Sep 3, 2015, at 09:57 AM, Dave wrote:
Ok, I think I've managed to add the “Equal Widths” constraints as per:
http://natashatherobot.com/ios-autolayout-scrollview/
I now go on to the following section:
I’m a bit lost as to what:
The constraints between the ScrollView and the ContentView are surprisingly straight forward – just bind the ContentView to the ScrollView (make sure the constant to the bottom layout guide is 0):
means? I took it mean set up constraints between the "Bordered Scroll View” and "Flipped Clip View”, so I select "Bordered Scroll View” and "Flipped Clip View” and then select Add Constraint, but it won’t let me click the top, bottom, left, right constraints as shown in the link?
Does anyone know of some clear instructions as to how to set this up in XCode/IB? I’m not sure if the link is different because of a difference in XCode versions (I’m using 6.4) or its iOS instead of Mac, or something else.
Yes, there's a pretty huge difference: UIScrollView doesn't have a contentView.
Here's a pretty simple and straightforward blog post about doing this on the Mac: http://blog.bjhomer.com/2014/08/nsscrollview-and-autolayout.html
Hi,
I’’ve looked at the above link and it sets it up in code, it says:
I'll demonstrate doing this in code, but the same principles apply in Interface Builder as well.
Then in the first step:
_scrollView = [[NSScrollView alloc] initWithFrame:self.bounds]; _scrollView.translatesAutoresizingMaskIntoConstraints = YES; _scrollView.autoresizingMask = NSViewHeightSizable | NSViewWidthSizable; _scrollView.hasVerticalScroller = YES; _scrollView.identifier = @"ScrollView";
It sets the _scrollView.translatesAutoresizingMaskIntoConstraints and _scrollView.autoresizingMask but this isn’t possible in XCode/IB as far as I can see. Does this assume that the NIB the view resides in is non auto layout? Also I guess I should set this on the Outlet to the Scroll View in code (since if I can’t do it in IB) ?
Also it shows the Clip View being Created in code, again can this be done in XCode/IB or should I do it all in Code?
Really confused as to what to do for the best here. I’ve been trying to follow some sample code and adapt it for my own App, but I can’t seem to get it right. The annoying part is that if I could get it to work Auto Layout would make life much easier/nicer, but I’m running out of time now and I’m going to have to drop it if I can’t get it to work. I’m wondering if I should post a Developer Support Incident but I’m sure sure that this qualifies?
An offical sample for the Mac from Apple that shows how to do this would be really useful.
All the Best Dave
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden