Swift: how to switch statusbar orientation in IOS 9+? - ios

I'm building a game that is based on gestures. IOS' native gestures that bring in notification center and control center on side swipe are super annoying as they interfere with gameplay.
Having searched extensively for a solution, I have come to belive that there is no way to disable/block control center or notification center on app level.
One possible solution that could help that I found was to turn the status bar orientation. My app runs in landscape orientation. If I could switch notification/control centers from top and bottom swipe to left and right swipes, I think that could almoast solve my problem.
However this seems to be possible but depreceted since IOS 9: https://developer.apple.com/documentation/uikit/uiapplication/1622939-setstatusbarorientation?language=objc
Apple suggests to use UITraitCollection instead. However I can't figure out how to change the orientation of the status bar using this. Sample code would be greatly appreciated!

From the same documentation it states:
you should not arbitrarily set status-bar orientation using this
method
This is even more true now because if you do try to use this method you get this warning (and it didn't actually work):
'setStatusBarOrientation(_:animated:)' was deprecated in iOS 9.0:
Explicit setting of the status bar orientation is more limited in iOS
6.0 and later
This is not something you should be trying to do with your app. Either hide the status bar or leave it at the top.

Related

How To Avoid iOS Blue Location NavigationBar Messing Up My StatusBar?

iOS has a feature that (I'm using both iOS 10 and 11) when you use a location-based app, say Waze, and you put that app on the background, there will be a blue navigation bar with a blue status bar background saying that Waze is currently using your location. Then open up your own project and close the Waze, this will happen.
Any idea how to fix this one? I'm guessing some configuration in the AppDelegate. Something to setup upon making your project active. I've tried the same steps in my other project and I have no idea why does that other project handle it a little better. The other project has a readable status bar but different background color, still quite a mess but better than in this project in the photo.
This is how your app should work:
The status bar is transparent.
Your view controller's main view should underlap the status bar; it should be fullscreen.
Your views should use autolayout to respond to changes in the size of the top bars (they should be pinned to the top layout guide or, in iOS 11, the top of the safe area).
You are not doing that correctly, so your app does not behave correctly when the status bar size changes due to the location manager bar. You probably have the same problem with phone calls coming in. You can easily test in the Simulator by choosing Toggle In-Call Status Bar.

is it possible to control status bar position under iOS 8?

I want to know if it possible to control the position of the status bar with iOS 8 SDK?
I know i can use supportedInterfaceOrientations method, but now with the iOS 8 SDK if i change the orientation of the rootViewController all child viewController will take the same orientation because of viewWillTransitionToSize method.
Somebody can help me ?
Thanks in advance
According to the apple docs here:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Bars.html
Don’t create a custom status bar. Users depend on the consistency of the system-provided status bar. Although you might hide the status bar in your app, it’s not appropriate to create custom UI that takes its place
This means that no, you cannot and should not change the default position of the status bar or put anything under it or around it that would obscure it. You can hide it or change its default appearance if you like, that is explained in the docs.

how to cover ios' baterry&time bar under my AIR app

I use flash builder to develop a game bases on AIR, but here are the question: my app's top position covered by ios' battery&time bar, so I cant click those buttons on the top position. How to resolve this question by using AS3.0 or some other methods?
You can hide the Device's notification bar at compile time by setting <fullScreen>true</fullScreen> in your myApp-app.xml descriptor file, you cannot control this at run time though.

How is the in-call status bar impacting my CGAffineTransform'd view?

My app (target iOS 5+, uses ARC and storyboards, for the App Store) uses some rotation transforms. There's a bug where an in-call status bar (such as if there's an ongoing phone call or microphone recording) causes the views to mutate beyond what the transform describes. To diagnose the problem I wrote a simple test app* that plays with a view's transform.
Initially (reproduced in simulators 5.0 and 6.1, and hardware 6.1) it looks like
After rotating by 20 degrees:
Still ok! But something weird happens when I toggle the in-call status bar (command-T):
Ok, well maybe it'll revert if I turn off the in-call status bar
Disaster! Let's try resetting the view's transform to CGAffineTransformIdentity
Oh what have I gotten myself into?!
Anyway, I'm new to CGAffineTransforms, and Quartz 2D as a whole, so I'd appreciate if someone could tell me why this is happening. The code is available on Github* if you want to poke around.
*Note that the code has been updated with a solution.
This is happening because toggling the in-call status bar changes the view frame, which (if it's set to autoresize subviews) autoresizes subviews accordingly. If the transformed view has any flexible margins, it could skew as shown in the above screenshots. To make it not skew like that, turn on all four struts.

Is this the right way to make an iPad app full screen?

I want to disable the status bar in iOS to make my app full-screen. I managed it but I'm not sure I did it correctly.
Here's what I did:
In IB, set the Simulated Metric for Status Bar to None
Added an entry in the Info.plist UIStatusBarHidden = YES
Moved my views around in IB so they fill the screen.
I'm not using OpenGL or anything like that, it's just a straightforward Cocoa Touch app which, like many others of a similar type, benefits from having access to every pixel on the screen.
To my shame I got the technique from one of those omnipresent 'tutorials' that litter the web like the dust bunnies under my bed. It was dated 2009. Is there a more modern, approved technique I should be using instead?
If it helps I'm targeting iOS 5 only.
The statusBarHidden property of the shared UIApplication object controls whether the status bar is visible. The UIStatusBarHidden entry in the app's Info.plist sets the value of that statusBarHidden property when the application is launched. You can change the property's value to hide or show the status bar while your app is running.
These are the current methods for controlling the status bar's visibility as of iOS 5.0.1.

Resources