Re: Auto layout and re-sizing subviews.
Re: Auto layout and re-sizing subviews.
- Subject: Re: Auto layout and re-sizing subviews.
- From: Daniel Höpfl <email@hidden>
- Date: Wed, 07 May 2014 00:31:47 +0200
Hi,
On 06.05.2014 23:32, lorenzo wrote:
> I posted this on SO, but got no answers, so I'm trying here and mabe I
> can get some help.:
>
> I have a window into which I horizontally add two subviews. Into each
> subview, I place a variable number of subviews made up of a vertical
> slider, a text field rotated 90 degrees and placed to the left of the
> slider and another textfield, placed just under the slider. The slider
> subview's constraints are done in code, the parent views are both done
> in IB. When I add more slider views to the left window than the subview
> can handle in its default size, it resizes horizontally and forces the
> window's content view (and window) to also resize horizontally. Great,
> that's just what I want. But if I add more slider subviews than can fit
> in the right subview, they just get squeezed together and the subview
> does not expand as the left. I layout the slider views using code with
> this category converted to support NSViews, instead of UIVews:
>
> UIView+AutoLayout1: https://github.com/jrturton/UIView-Autolayout
>
> The constraints for the left and right subviews are more or less the
> same. I can't figure out why the right view does not resize as the left
> view does.
>
> Here is a link to a sample project that demonstrates the problem:
> http://www.spikesoft.net/wp-content/uploads/2014/05/SliderTest.zip
>
> Can someone point me in the right direction?
In your MainMenu.xib, there is a constraint "[Left view]-(233)-|" that
needs to be "[Left view]-(>=233)-|".
(Also, in SliderController's intrinsicSize you use
_counterField.frame.size.height when calculating size.width. Not sure if
this is correct.)
Bye,
Daniel
_______________________________________________
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