开发者

How to keep NSPanel within NSScreen visibleframe always

I have one floating NSPanel in my a开发者_Go百科pp, which user can move using mouse. I want my NSPanel to always visible within main screen. I want code to reposition my NSPanel with its original width and height within screen border in all the sides.

Thanks,


Subclass NSPanel and override the frame-relative methods. setFrameOrigin:, setFrame:display: and maybe others (see the documentation to find out all the methods). There is also promising - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜