views:

31

answers:

0

Hi everyone

I am experiencing some weird behavior with my iPad app. I usually add a view to my viewController like this:

CGRect bounds = [[UIScreen mainScreen] applicationFrame];
// Add Basic View
UIView *myView = [[UIView alloc] initWithFrame:bounds];
myView.backgroundColor = [UIColor blackColor];
self.view = myView;
[myView release];

On the iPhone this always works like a charm. On my iPad app however, I add a toolbar to this self.view as a subview with the rectangle (0, 0, self.view.frame.width, 100). Sometimes this works out well and the toolbar displays right below the status bar, yet in certain conditions (eg. when the iPad is lying flat on a table and the interface orientation is portrait) my toolbar slides partly below the status bar. Yet as soon as I rotate the device everything is fine again and the toolbar is aligned properly with the status bar.

I have tried some workarounds with adding values a few points to the origin.y property of the toolbar, yet when I do this the toolbar gets an offset to the status bar after rotating the device. I am really confused by this, did anybody else ever experience this problem? If so, how did you fix it?

Thanks a lot!