简体   繁体   中英

How to resize only one side of NSWIndow programmatically?

From the Apple documentation, we can modify the resizing value(multipliers) by assigning new values to ResizeIncrements.

But The minimum value is 1 so, I was wondering if resizing only one side (only Width or only Height at a time) is possible.

I've tried to use callback, resetting the size of the NSWindow each time the user drag to resize it, but it's not working.

Edit:

To be more specific, I'd like to know if restricting the resizing option to only one side is possible.

Yes simply override windowWillResize:size: and return whatever value you want to allow.

I don't believe resizeIncrements will affect this; that just sets the increments to allow but the window delegate will have the final say.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM