Search code examples
objective-cmacosnsviewcontroller

Closing a window upon segue to new window


I am currently working on a game. I have 2 windows, a menu window and a game window. Upon pressing the run button on the menu, I programatically segue to the game window. However, the menu window stays after the segue. Assuming the menu viewcontroller is unaware of the window controller, what is the best way of closing the menu window from the menu viewcontroller?


Solution

  • Somewhere inside menu view controller, in place where you going to close your menu window, you call

    [self.view.window performClose:nil];