开发者

cocoa -- What is the proper way to tell an NSWindow to redisplay its contents?

开发者 https://www.devze.com 2023-02-03 18:56 出处:网络
According to the NSWindow Class Reference, you should \"rarely need to invoke\" the NSWindow methods \"display\" or \"setViewsNeedDisplay\".So what is the usual way to redisplay the window\'s contents

According to the NSWindow Class Reference, you should "rarely need to invoke" the NSWindow methods "display" or "setViewsNeedDisplay". So what is the usual way to redisplay the window's contents?

ED开发者_StackOverflow社区IT: I am having trouble dealing with resizing events. I just want to have everything scale proportionally. See this question. As no one seems to have any ideas for using masks to get it to happen, I want to redraw the whole thing.


Jason's comment really should be an answer:

Generally you don't need to. Instead, you invalidate whatever view needs to be invalidated for whatever reason within the window.

In addition to that comment, I'd add that you might want to explain why you feel you need to do this. While there are sometimes perfectly valid reasons to force the whole window to redraw, they are rare and you should suspect You're Doing It Wrong™.

Use this method to flag subviews for redisplay:

- setNeedsDisplay:YES
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号