it's possible to get window width or height while resizing it? not on start or end of resizing (viewWillStartLive开发者_StackOverflow中文版Resize, viewDidEndLiveResize), but in real time?
Yes. Set an object as the window's delegate and implement either of these delegate methods:
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
- (void)windowDidResize:(NSNotification *)notification;
The -windowDidResize:
method is sufficient if you want to keep some other window synchronized to the size of your window as it is called with every small size change, not at the end of the resize operation.
If your window's content view resizes with the window, and you're willing to make that view a custom NSView subclass, then you can override -[NSView resizeSubviewsWithOldSize:]
and check self.bounds
there.
精彩评论