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.
精彩评论