开发者

Closing old window when opening a new one in Cocoa

开发者 https://www.devze.com 2022-12-12 23:31 出处:网络
Ok, I have two windows, A and B.When I click a button on Window A, I want it to close and take the user to Window B.开发者_运维技巧makeKeyAndOrderFront does a great job of activating Window B, but how

Ok, I have two windows, A and B. When I click a button on Window A, I want it to close and take the user to Window B. 开发者_运维技巧makeKeyAndOrderFront does a great job of activating Window B, but how do you get it to then close Window A?


Send window A a close or performClose: message (depending on whether you want to emulate the user closing the window, which is the latter, or simply close it immediately and unconditionally).

Note that closing the window may release it; see the releasedWhenClosed property, which has a checkbox in IB and may already be turned on there. You may want to order the window out (as compared to ordering in, such as by ordering front) instead.

0

精彩评论

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