Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:39:33+00:00 2026-06-18T12:39:33+00:00

I have a nib with autolayout enabled containing a view controller’s views and, separately,

  • 0

I have a nib with autolayout enabled containing a view controller’s views and, separately, a window with a placeholder view to add them it into. The placeholder has constraints relative to its superview and other views in the window, and before involving my view controller, I have the placeholder resizing with the window the way I want. Later I load the nib and add its top-level view as subview of the placeholder, and I also manually create constraints to keep it aligned to the placeholder’s edges.

All good, and I’m using this pattern in several instances within my app, but in some of those cases, after adding the view my window gets resized! It’s shrinking to the minimal size for the added view instead of the view expanding to the current size of the window.

So far the only way I’ve found to prevent this is that when adding the view and creating its constraints, to also set the view’s frame to give it the initial size for the current state of the placeholder and window. That’s ok some of the time, but I want to be able to define constraints that are more complicated that simply aligning each edge to a placeholder superview. I don’t want to code the frame arithmetic for each of those cases.

Does anyone know what’s going on? If the window is already dictating the size of my placeholder, not the other way around, what do I have to do when adding the subview to make the current window size still take precedence?

I’ve seen the pop-up menu in Xcode’s IB windows that seems to be about constraints affecting only subviews vs also superview (set to the former for all my nibs), is what’s happening related to this functionality? I haven’t found anything else about that yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:39:35+00:00Added an answer on June 18, 2026 at 12:39 pm

    You want to set the compression resistance priority to something less than NSLayoutPriorityWindowSizeStayPut which is 500. This means that the size of the window takes priority over the size of the view.

    You can set this from the IB size inspector.

    Compression resistance priority

    Or you can set it programmatically with -[NSView setContentCompressionResistancePriority:forOrientation:]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Nib file containing grouped table view and a cell. The cell
How would I go about presenting a view controller that doesn't have a nib
In my application i have a nib file (view A) containing some textFields. In
I have two nib files: the main application window, and a small view that
I have a Nib with a scrollview which i use on my controller. I
I have a NIB with two NSWindow objects. The controller class has two IBOutlets,
In iOS apps, we have to register nib files with our table view before
I have created 2 views named FirstView and SecondView. Both views have nib files.
I have a nib (winA.xib) that contains a window. My app delegate contains an
I have a strange issues. I have a nib file with some view inside

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.