NSWindow start position based on size

Originator:keithbsmiley
Number:rdar://19832212 Date Originated:13-Feb-2015 01:55 PM
Status:Open Resolved:
Product:OS X SDK Product Version:10.10.2
Classification:Other Bug Reproducible:Always
 
Summary:
When setting the start position of an NSWindow in a storyboard, the actual position after launching the application is calculated before calculating the actually window's size based on its NSViewController and its content.

Steps to Reproduce:
1. Create a NSWindowController in a storyboard
2. Select the NSWindow and set its initial position to centered both horizontally and vertically
3. Make the windows NSViewController thin
4. Add a view to the NSViewController that constraints the width
5. Launch the application

Expected Results:
The thin window should be perfectly centered in the screen.

Actual Results:
The thin window is slightly off center horizontally, because the windows origin was calculated before calculating its width.

Notes:
You can fix this by putting the actual size of the window into the storyboard. Although this size may not always be known at this time.

Comments

https://github.com/Keithbsmiley/radars/tree/master/NSWindowStartPosition

By keithbsmiley at Feb. 13, 2015, 10:01 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!