Andrew Chang
Andrew Chang

Reputation: 1319

Cocoa: How to show a window un-modally?

I have un-checked the "Visible At Launch" option for the default window in MainMenu.xib file. But then, I could not find out how to show it programmatically...

Do anyone know how to show this window, un-modally?

Thank you at advance!

Upvotes: 0

Views: 66

Answers (2)

GoodSp33d
GoodSp33d

Reputation: 6282

If you want to activate your window and make sure its on top of other windows you need to call makeKeyAndOrderFront:. This will ensure that your window pops up on all other windows(even from other windows). orderFront will not make your window the key window(i.e the topmost/active window)

Reference : https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/makeKeyAndOrderFront:

Upvotes: 0

user2523232
user2523232

Reputation: 319

First, you should build an connection from this window to an IBOutlet variate. Then you can use this variate to make window visible by calling the "orderFront:" method, just like "[window orderFront:self];". Here's the link.

Upvotes: 1

Related Questions