Dear Dev List,

I've noticed strange window resizing behaviour the last couple of weeks, 
possibly since I upgraded to Mountain Lion.  This may also be a resolution 
thing, as I've only tried this on a Retina MacBook.

I have Table Views in a number of views that are swapped in and out by the 
window controller.  Each view has their own maximum sizes that are transferred 
to the Window when the view is changed.  Clicking the Zoom button twice when a 
Table View is a subview, causes the size of the window to get stuck at an 
unexpected size.

Steps to reproduce (as this is hard to explain):

1. Create a new Cocoa Application project, not Document-Based.
2. Core Data and Unit Tests aren't necessary, and don't seem to affect this 
behaviour.  I've always had ARC enabled.
3. Drag a Table View or Outline View into the window of MainMenu.xib (Text 
Views and other Scroll View enclosed views don't seem to be affected).
4. Add this single line of code to applicationDidFinishLaunching:

[self.window setContentMaxSize: NSMakeSize(1000.0, 5000.0)];

5. Build and launch the app and click the green Zoom button twice.

On the second clicking, you should find the window has decided it would enjoy a 
new vertically minimum size, and it can't be dragged smaller.

This doesn't seem to occur if the height given to setContentMaxSize: is less 
than the available screen area (i.e. less than ~850 on an effective resolution 
of 1440x900 -> 900 minus menu bar).

I had put in larger sizes because these particular views don't really have a 
maximum size, but other swapped in views do.  Unless I'm missing something, 
there doesn't seem to be a way to clear the maximum size when a new view is 
available.

An obvious solution to this, is to have the maximum size come from NSScreen, 
which is probably what I will do.  If going this route, how does one deal with 
the user moving the application from a screen with a higher resolution to one 
with a lower resolution.  I set the max size once when the view changes.  Does 
it also need to be changed when the screen changes?

However, my previous solution did work on previous version of OS X.  Was it 
always wrong, or is this unintended new behaviour in 10.8?

Thanks,
Arved
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to