4 Replies
      Latest reply on Sep 28, 2019 1:00 PM by Tlaloc
      Tlaloc Level 1 Level 1 (0 points)

        Since I switched to XCode 11 I get a a huge list of warnings: views without any layout constraints may clip their content or overlap other views. These are in non-resizeable panels or windows that don't use autosizing. My target OS is 10.10. I've tried to fix this by using all three options in the text field width, both options in the layout menu and checking/unchecking the lines in the autoresizing box but none of these things get rid of the warnings. Generally Interface Builder doesn't show the layout constraints inthe .xib. Also the popup menu asking me to add the needed layout attributes doesn't fix this.

         

        What can I do?

        • Re: XCode 11 layout constraints warnings .xibs Mac OS
          Tlaloc Level 1 Level 1 (0 points)

          The autolayout guide describes things that are not part of my project. For example scenes. The guide describes constraints as being added when one drags UI elements into a scene. This is not the situation I have. I already have the templates for dialogs and windows in .xibs. There is a small yellow dot in the pane with the warnings but when I click on it and ok adding layout constraints, it doesn't. Is Apple requiring layout constraints in Mac OSX applications? Do I have to re-design my UI templates as playgrounds with scenes or will the newly added sub menus under resolve autolayout constraints allow me to add them. This is a BIG hassle I don't need in windows that don'r resize.

          • Re: XCode 11 layout constraints warnings .xibs Mac OS
            Tlaloc Level 1 Level 1 (0 points)

            Editor->Resolve auto layout issues->Add Missing Constraints:

             

            Alert:

             

            Failed to automatically update constraints

             

            Interface Builder encountered an internal error while attempting to automatically update constraints. Your most recent change has been automatically reverted.

             

            A folder of diagnostics files has been created. Please file a bug at https://feedbackassistant.apple.com and attach an archive of the diagnostics folder.

            • Re: XCode 11 layout constraints warnings .xibs Mac OS
              Tlaloc Level 1 Level 1 (0 points)

              From the Xcode 11 release notes:

               

              NSView and UIView have a layout mode option in the Size inspector to explicitly opt into “translates autoresizing mask into constraints”. The default setting is “Automatic”, which is the existing behavior. “Automatic” implies that “translate autoresizing mask into constraints” is off when a view affect by constraints in the storyboard or .xib file, but on if unconstrained. (37352354)

               

              Displaying NSViews and sub-classes will work with views that have no constraints. Whether you select automatic or translate autoresizing mask into constraints in the Layout menu you will see a lot of layout errors, at least in a window with a lot of views.

               

              The tool that is included in Xcode 11 to add these resources is severely broken. My project has15 small panels with a few UI elements. I was able to add layout constraints to these with the tool but it took several tries. The tool sometimes did things like greatly increase the size of the window or add layout constraints to only some of the NSViews. My application has one window with a lot of NSViews. Neither the tool nor Interface builder can deal with this. In the window with a lot of NSViews I tried to add layout constraints to all of these, to some of these in a column and to only single ones and the tool fails to do it and asks me to report the problem to Apple bug reporter. It looks like you will have to ignore a lot of warnings until Xcode 11.1.

              • Re: XCode 11 layout constraints warnings .xibs Mac OS
                Tlaloc Level 1 Level 1 (0 points)

                I figured out how to solve the problem:

                 

                Check every NSView in your panel or window. Set the layout to Translates mask into constraints. Be sure that all four red lines are connected to the frame. Constraints will be required only if the autoresizing is not locked to the frame. Older versions of XCode allowed you to be sloppy about this so I was careless and some of my NSViews weren't locked to the window's views.