iOS 7 Status bar transparency
Solution 1
I'll answer to my own question, sorry about the waste of time.
My mistake was, the status bar was transparent. But for whatever reason, calling
[self.navigationController setNavigationBarHidden:YES animated:YES];
changed the top inset of my scrollview from 0.f
to 20.f
... So, I had a black background under my status bar, and therefore, a black status bar.
Thanks anyway !
Solution 2
Add this code to your .m file:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
DCMaxxx
Objective C lover. Interested in almost everything about computer sciences. Student at Epitech, currently studying abroad at RMIT, Australia
Updated on August 05, 2022Comments
-
DCMaxxx almost 2 years
I'm stuck on something that looks trivial, but I really don't understand what's happening.
I'm compiling with iOS 7 SDK, and can't get the status bar to be transparent. It's fully black. In my .plist,
Status bar style
isTransparent black style (alpha of 0.5)
. I've tried all the other options, but I couldn't get it to work.I still need to support iOS 6, but I'd expect iOS 7 status bar to be transparent by default, right ?
Any idea on what could cause this ?
Thanks
-
DCMaxxx over 10 yearsI've tried this, that's pretty much every SO answer about that. No matter what
View controller-based status bar appearance
is set to in this info.plist, this function isn't called (can't fire a breakpoint, nor an NSLog) -
DCMaxxx over 10 yearsFor the record, the error came from
automaticallyAdjustsScrollViewInsets
set toYES
. -
stuckj about 10 yearsYou just made my day. Had the same problem with initial display of a view inside a UIPageViewController. The UIPageViewController went under the status bar, but the initial page in the controller would be offset below the status bar. I was also using setNavigationBarHidden with the animation to display the page controller. Setting automaticallyAdjustsScrollViewInsets to NO in the page controller fixed it. You just ended a day of banging my head against the wall...thanks. :)