views:

43

answers:

2

Hi,

In my iPad app, I am presenting a modal view controller with the UIModalPresentationPageSheet style. Today, randomly, when I presented the modal view controller, the page sheet was rendered without the white background, leaving just the shadow:

alt text

I have not made any changes to the view controller that is being presented, or the view controller that is presenting during the time frame in which this started happening. I've tried cleaning the target, deleting the build folder and rebuilding, resetting the simulator, and switching between LLVM and GCC compilers, however, nothing seems to correct this problem.

I don't see how anything I could have done would cause this, so I'm thinking this is a bug, but I don't know why this started happening just all of a sudden. I don't have an iPad, so I can't test to see if this happens on device.

UPDATE: I got a friend with an iPad to test on device, and the same thing happens. I also deleted the view controller that was being presented, and then created a new view controller with just the bare bones Xcode UIViewController template, and this still happens.

A: 

are you presenting images in that view controller? try deleting them and readding them to the project. if its a nib try the same thing there. interesting problem.

Jesse Naugher
The view controller doesn't have a nib. I was adding some subviews in `viewDidLoad`, but I've removed all of those, so its basically a blank view controller.
macatomy
A: 

Problem solved. There is definitely a bug in the SDK relating to this, but there is a simple workaround.

I was loading my view controller without a XIB because I was doing all my layout in viewDidLoad. So my code for allocating the view controller looked like this:

ViewController *viewController = [[TimeSettingsViewController alloc] initWithNibName:nil bundle:nil];

To fix the issue, I made an empty view XIB (ViewController.xib), set File's Owner to the view controller class (ViewController in this example), then linked its view property to an empty view. Then I changed my code to load from the nib instead:

ViewController *viewController = [[TimeSettingsViewController alloc] initWithNibName:@"ViewController" bundle:[NSBundle mainBundle]];

So for anyone else who runs into this issue, there's the fix. What I'm confused about, however, is that I have been creating the view controller without a nib for a while now, and it doesn't make any sense that this problem just came up randomly.

macatomy