开发者

Centering a document window

开发者 https://www.devze.com 2023-03-04 15:17 出处:网络
I am writing a core data, document based app. I a开发者_C百科m trying to center the document\'s window. I have tried calling the following code from the document\'s makeWindowControllers method, from

I am writing a core data, document based app. I a开发者_C百科m trying to center the document's window. I have tried calling the following code from the document's makeWindowControllers method, from the window controller's awakeFromNib method and from the window controller's showWindows method. I keep getting a nil result for myWindow. Any ideas? Thank you.

NSWindow *myWindow = [myWindowController window];
[myWindow center];


A common reason for -window to return nil is not having set the corresponding outlet in the nib file.

Make sure the nib file’s owner is your NSWindowController subclass and its window outlet has been linked to the window object.

0

精彩评论

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

关注公众号