Re: UIScrollView question
Re: UIScrollView question
- Subject: Re: UIScrollView question
- From: Quincey Morris <email@hidden>
- Date: Sat, 26 Jul 2014 23:12:34 -0700
On Jul 26, 2014, at 22:19 , Luther Baker <email@hidden> wrote:
> Are you hoping that when the keyboard comes up -- it shortens the parent view you are referring to?
No, it’s more complicated than that, but I think it’s the *question* that’s complicated, more than the answer.
First you have to decide what you actually want to happen when the keyboard is up. You have 4 views, you said, 3 of which I assume are short (maybe about 1 line high each), and the last of which takes up the rest of the screen normally.
So, when the text view becomes first responder and brings up the keyboard, do you want all of them to keep their original sizes, but just scroll what doesn’t fit off the top of the screen? Or do you want to have the top 3 views to keep their original sizes, and the text view to get smaller according to how much space is left by the keyboard? Or something else?
If you don’t need to change the scroll view’s size (if “yes” to the first question — which I think is what you originally described as the goal), then setting the content and scroll indicator insets (along with scrolling the current insertion point onto the screen) ought to be all you need. You don’t actually need to resize anything.
If you need to change the scroll view’s size, then any auto layout constraints *inside* the scroll view should keep your text view at a suitable size, and you shouldn’t need to muck about with the layout inside the scroll view manually. The problem then becomes one of getting the scroll view itself sized correctly.
If the scroll view itself is subject to auto layout constraints relative to its own ancestors and siblings, I guess you’ll have to update its height-controlling constraint, *or* override its superview’s ‘layoutSubviews’ to set its frame directly after auto layout has had at it.
If the scroll view is not subject to auto layout constraints, then you can just resize it directly.
That’s a lot of if’s…
_______________________________________________
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