• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Auto layout and re-sizing subviews.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto layout and re-sizing subviews.


  • Subject: Re: Auto layout and re-sizing subviews.
  • From: Lorenzo Thurman <email@hidden>
  • Date: Tue, 06 May 2014 19:18:41 -0500

On May 6, 2014, at 5:31 PM, Daniel Höpfl <email@hidden> wrote:

> 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

I had this at some point in the past, as I was adjusting the constraints to achieve the desired behavior and just overlooked this one through the troubleshooting process. I’m still rather new to Auto Layout so I guess sometimes you can see the forest for the trees. Thanks for pointing out my error and I’ll take care of the slider’s intrinsic view size.

_______________________________________________

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


References: 
 >Auto layout and re-sizing subviews. (From: lorenzo <email@hidden>)

  • Prev by Date: Re: Document being reopened on launch during modal dialog
  • Next by Date: Re: How to convert a UTF-8 byte offset into an NSString character offset?
  • Previous by thread: Re: Auto layout and re-sizing subviews.
  • Next by thread: NSWorkspace issue
  • Index(es):
    • Date
    • Thread