iOS7 UIWindow wrong height after status bar hidden

91 views Asked by At

I added an UIWindow with a subView of an UIView to current key window.

CGFloat width = 35;    
self.window = [[UIWindow alloc] initWithFrame:CGRectMake(0, [UIScreen mainScreen].bounds.size.height - width, width, width)];
self.window.backgroundColor = [UIColor yellowColor];
self.window.windowLevel = UIWindowLevelStatusBar;
self.window.hidden = NO;

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, width)];
view.backgroundColor = [UIColor redColor];
[self.window addSubview:view];

enter image description here

And when I called

 [[UIApplication sharedApplication] setStatusBarHidden:sender.selected withAnimation:UIStatusBarAnimationSlide];

In iOS7, after the window has been added, the window's height changed automatically to the screen's height

enter image description here

So what may cause this problem?

0

There are 0 answers