views:

358

answers:

1

Hi,

I recently started a project, using Apple's Utility Application example project. In the example project, there's an info button that shows an instance of FlipSideView. If you know the Weather.app, you know what the button acts like.

I then changed the MainWindow.xib to contain a scrollview in the middle of the window and a page-control view at the bottom of the window (again, like the Weather.app). The scrollview gets filled with instances of MainView. When I then clicked the info button, the FlipSideView would show, but only in the area that was previously filled by the MainView instance – this means that the page-control view on the bottom of the page still showed when the FlipSideView instance got loaded.

So, I thought that I would simply add a UIViewController for the top-most window, which is the one declared inside the AppDelegate created along side with the project. So, I created a subclass of UIViewController, put an instance of it inside MainWindow.xib and connected it's view outlet to the UIWindow declared as window inside the app delegate. I also changed the button's action, so that it know sends a message to the MainWindowController instance. The message does get sent (I checked with NSLog() statements), but the FlipSideView doesn't get shown. Here's the relevant (?) code:

FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self;

controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];

[controller release];

Why's this not working from inside of MainWindowController, but the exact same code is working from inside of MainViewController? I've uploaded the entire project here for you to be able to see the whole thing.

Thanks for help!

-- Ry

EDIT: I think it might be related to me attaching the UIViewController's view outlet to an UIWindow instance. I now connect it to a UIView, and it's working perfectly well.

+1  A: 

For the record, the answer has been added in the question. Ryyst said:

I think it might be related to me attaching the UIViewController's view outlet to an UIWindow instance. I now connect it to a UIView, and it's working perfectly well.

Laurent Etiemble