Set NSWindow Size programmatically
问题 How can I set the window size programmatically? I have a window in IB and I want to set the size of it in my code to make it larger. 回答1: Use -setFrame:display:animate: for maximum control: NSRect frame = [window frame]; frame.size = theSizeYouWant; [window setFrame: frame display: YES animate: whetherYouWantAnimation]; Note that window coordinates are flipped from what you might be used to. The origin point of a rectangle is at its bottom left in Quartz/Cocoa on OS X. To ensure the origin