Sandeep Bansal
Sandeep Bansal

Reputation: 6394

HUD window to stay within Application? Xcode

I will like a HUD window to be only dragged around in my application and it can not go out of it. Is there anyway or any other component that will allow me to have a sub-window and not be able to be dragged out of the applications boundaries.

Thanks.

Upvotes: 1

Views: 554

Answers (1)

Rob Keniger
Rob Keniger

Reputation: 46028

Your question is a bit vague but it sounds like you want to constrain a window's frame so that it is never outside the boundaries of another window.

To do this you'd need to make your HUD window a custom subclass of NSWindow. You would then override ‑setFrame:display: and call super's implementation, passing in the frame that you want the window to use.

Upvotes: 3

Related Questions