Re: Xcode 7.3.1: Auto Layout drives me crazy
Re: Xcode 7.3.1: Auto Layout drives me crazy
- Subject: Re: Xcode 7.3.1: Auto Layout drives me crazy
- From: Kyle Sluder <email@hidden>
- Date: Fri, 20 May 2016 10:15:51 -0500
On Fri, May 20, 2016, at 05:56 AM, Ulf Dunkel wrote:
> Am 18.05.2016 um 22:29 schrieb Quincey Morris:
> > On May 18, 2016, at 10:54 , Ulf Dunkel <email@hidden <mailto:email@hidden>> wrote:
> >>
> >> How can I debug Auto Layout issues when the Assistant Editor's Preview shows that everything seems to be fine?
> >
> > You might try using the graphical view debugger to look at your view hierarchy in “3D”. It sounds like a view higher up isn’t resizing when it should.
> >
> > The other issue to consider is priorities. If the text trailing constraints are lower priority than something else, they may be being silently ignored.
>
> Thank you for pointing me to the Graphical View debugger, although it
> didn't help much. My XIB is an NSView, like this one:
> https://man.icalamus.net/en.lproj/menu_file_doc_setup.htm
>
> In English, everything looks fine, and most other languages are
> auto-layouted fine, too. But when you compare it e.g. with Spanish,
> you'll see that some things aren't properly auto-layouted on runtime,
> although they are in the Assistant Editor.
> https://man.icalamus.net/es.lproj/menu_file_doc_setup.htm
>
> The words "Ancho:" and "Altura" in the "Formato" NSBox aren't properly
> right-aligned and thus the NSBox is too small.
They look right-aligned to me. Open your favorite image editor and drop
a vertical line at the right edge of the colon in “Altura:”, and you’ll
see it aligns perfectly with the right edge of the o in “Ancho”. Is the
problem that “Ancho” is missing a colon?
> The checkbox string "La
> primer página es la página derecha" is clipped, as if the main NSView
> hesitates to enlarge. Its Horizontal Content Hugging Priority (HCHP) is
> even set to 100.
The relevant property here is Compression Resistance, not Hugging
Priority. Compression Resistance prevents clipping; Hugging Priority
prevents stretching.
Also, that’s a really long string. You might want to opt for a shorter
localization.
>
> The left NSBox has a HCHP of 248, as have the included label text
> objects. The right NSBox and its label text objects have a HCHP of 249.
>
> I really wonder if the issue is founded in the "Translates Mask Into
> Constraints" checkbox which is set for the main NSView:
> -[NSView setTranslatesAutoresizingMaskIntoConstraints:].
>
> If I uncheck this option an run my app, the first time every object is
> correctly auto-layouted and shown, but not the main NSView. When I close
> the sheet and re-open it, the main NSView size has been adjusted and
> shows every content properly, like the Assistant Editor does.
>
> Is this the point where I should dig deeper?
It sounds like you need to rethink your constraints, particularly your
use of hugging and compression resistance. If your goal is to have the
same visual balance and proportions in all languages, start by creating
proportion constraints between your two top-level NSBoxes, then work
your way down.
--Kyle Sluder
_______________________________________________
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