Prevent In-Call Status Bar from Affecting View - ios

Is it possible to prevent the in-call status bar from affecting my app's views?
I would like the in-call status bar to ideally simply appear on top of my view and not affect its frame (neither by changing the height nor by changing the origin and pushing the view down).
Is that possible?

Answering my own question, the best solution I was able to find for this is to manually change the main view's frame to start at the origin and have the size of the entire screen (both width and height). That way, you receive the same effect as you would if you were to use a navigation controller for example, where the view remains in place and the in-call status bar appears to be on top of it (on a different layer, without affecting the app view's display).

Related

Xcode uiscrollview shows up behind nav bar in IB

Trying to set up a scrollview in a UIViewController that has a nav bar. In IB my content gets pushed up to the top below the nav bar (see image).
When running the app on my phone the view is pushed down to sit below the nav bar which is fine. Is there anyway to get it to reflect like this in IB. It is hard to set up my content when half of it is cut off.
If I add a constraint to make the top of the view sit below the nav bar when I run the app it adds that offset and doesn't look correct. (I guess I could alter the constraint before running on my phone but seems like a ridiculous hack just to layout my app). (Already having major issues getting my scrollView to work the way I want it to... don't scroll if my content fits the screen but also use the scroll view to move the view up if the content is covered up by the keyboard but thats for another post)
when I run in simulator looks like this
In Interface Builder you should make sure your NavigationBar is set to Opaque in the simulated metrics. When you have a transparent Nav bar content can go underneath it.
It might look right in your app if you have a global attribute applied to make sure all nav bars are not translucent.

Any quick solution to make a view appear behind the status bar in iOS 7?

I'm porting my app from iOS 6 to IOS 7 (there will eventually be a complete GUI redesign for iOS 7 but in the meanwhile just getting the existing GUI to display properly on iOS 7 is the goal.
I had the issue where the status bar was overlapping my GUI and so have shifted the Y origin of the view controller's view down by 20.
However my app contains a pulldown which when retracted is overlapping with the status bar. In the screenshot the red is a button which is present in the pulldown view. The grey bar is the top of the main view behind which a portion of pulldown is hiding when retracted.
I implemented the pull down as a fixed size child subview of the main view and when retracted its Y origin is a negative number thus it is effectively still displayed but off the top of the screen. When the user pulls it down I just animate the increase in the Y origin until eventually the origin is 0.
Is there some way I can make the pull down view appear beneath the status bar or some other quick solution?
Note of course I can't simply toggle the pulldown's alpha to display/hide it as it pullsdown obviously thus its appearance/disappearance is not a discreen action. I could maybe attempt to make the portion of it that is on top of the status bar invisible but as its something that is moving that seems like its going to be complicated. Is there any simple solution?
Thanks
Add another view, with a fixed position, under the status bar (with the same color of your grey bar), 20px tall and same width of the status bar, but with a z-index higher than the retracting view. This view will cover the retracting view (but not the status bar) acting as a "background" for the status bar itself. Obviously you have to adjust the Y position of the retracting view to make it tappable by the user (but under the status bar)
iOS 7 by default lets views take up the fullscreen, including the status bar. This is controlled using the UIRectEdgeAll property.
If you want the old style view, set UIRectEdgeNone for self.edgesForExtendedLayout
in viewDidLoad:
self.edgesForExtendedLayout = UIRectEdgeNone;

UIViewController: Preferred way to handle Content scrolling behind transparent status bar

With iOS 7 we get the fancy transparent/blurry status and navigation bars.
I saw many posts here on SO talking about the content being overlapped by the status bar.
I understand why this is happening and it's ok in my case.
Now, I was wondering since I don't have navigation bars in my app:
How shall I handle any content being scrolled behind the transparent status bar.
(Note: By scrolling I mean real scrolling through content)
In my opinion it doesn't look nice if the status bar simply overlaps the content.
Is there an easy way to make it look "nicer"? Or do I have to play with offsets and manual blur to achieve a better look?
If I have understood the question, could you not place the background image to cover the entire screen and offset the scroll view y position by 20px (the height of the status bar).
Therefore you still get the nice effect of the transparent status bar but no content ever going under the bar itself.

Best Practice to handle the extended height status bar with a WantsFullScreenLayout app?

In an app which has the wantsFullScreenLayoutset to YES, what is the best practice to handle an extended height status bar, i.e. with the extra status bar presented when a phone call or a VoIP app is present, or when the personal hotspot feature is activated?
Is the UIApplicationWillChangeStatusBarOrientationNotification notification (or the corresponding delegate method of UIApplication the right way to do it, or am I overlooking something obvious?
I have put up a little sample project here to demonstrate the issue.
Thanks
Alex
The status bar with extended height can only be shown on iPhone or iPod in Portrait orientation.
You can get notified when the status bar frame will change using the UIApplicationWillChangeStatusBarFrameNotification (not UIApplicationWillChangeStatusBarOrientationNotification). This notification will also be posted when the interface orientation changes. On a frame change you could re-layout the views manually. Take the value of [UIApplication sharedApplication].statusBarFrame.size.height into account. It is 40 points in case of the extended status bar.
However, it is much simpler to hide the status bar completely for fullscreen view controllers so that the view can take advantage of the full display:
[UIApplication sharedApplication].statusBarHidden = NO;
You could also do something similar like in the photos app: Use the translucent status bar style and let the user hide the status bar with a single tap or hide it automatically after some time (when the user is not interacting with the app). This should be animated. Use the method setStatusBarHidden:withAnimation:.
Note that wantsFullScreenLayoutis a view controller property and not a property of UIApplication. You need to be careful when not all view controllers are presented in full screen mode.
From the Apple documentation:
wantsFullScreenLayout
A Boolean value indicating whether the view should underlap the status bar.
#property(nonatomic, assign) BOOL wantsFullScreenLayout
Discussion
When a view controller presents its view, it normally shrinks that
view so that its frame does not overlap the device’s status bar.
Setting this property to YES causes the view controller to size its
view so that it fills the entire screen, including the area under the
status bar. (Of course, for this to happen, the window hosting the
view controller must itself be sized to fill the entire screen,
including the area underneath the status bar.) You would typically set
this property to YES in cases where you have a translucent status bar
and want your view’s content to be visible behind that view.
If this property is YES, the view is not resized in a way that would
cause it to underlap a tab bar but is resized to underlap translucent
toolbars. Regardless of the value of this property, navigation
controllers always allow views to underlap translucent navigation
bars.
The default value of this property is NO, which causes the view to be
laid out so it does not underlap the status bar.
This answer applies up to iOS 6, I'll update this post when iOS 7 is available.

Why are touches not detected at top of screen with status bar hidden?

In our app, we show modal windows that take up the whole screen, and we hide the status bar at this time. However, buttons placed at the top of the screen have reduced hit areas: their tops do not detect touches. This is true of custom buttons and buttons in the navigation controller.
What is preventing detection of those touches?
FYI: I have two other windows, a HUD view and a status bar overlay, and both are hidden. I've tried putting the status bar overlay behind the main window, as well. Problem remains.
Update: This problem is caused, at least in some cases, by hiding the status bar while still having a scroll view with scrollsToTop set to YES. Although I have found a case where the problem remains even after disabling scrollsToTop for all resident scroll views. (I wrote a simple method to walk the view hierarchy to find all scroll views and report their current scrollsToTop setting.)

Resources