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

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.

Related

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

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.

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.

Auto adjust layouts after restoring iOS status bar

After initially designing my UIViewControllers in storyboard without a status bar, I have been instructed that we need to put them back in. Now all the layouts overlap the status bar. Is there an easy way to have everything automatically adjust to start with y=0 below the status bar? Moving and re-pinning everything to the top layer guide is going to be both tedious and error prone - seems like it should happen automatically.
I am using Xcode 6.1, targeting iOS 7.1 and later.
I think there is just one way to make a script to rewrite Storyboard XML file. You try to change constraints for one ViewController manually and check the difference.

UI becomes unresponsive when device is rotated in increments of 180ยบ

I have a really strange issue here. One of my testers found when they rotate my device in increments of 180 degrees the device UI will stop responding (not crash), but when rotated by 90 degrees, it works fine.
After some exploration with the Reveal app I found that after the app becomes responsive, a UISnapshotView is covering my UI, when I tell that layer to hide, I find that my app is still working fine behind it.
I am not creating that layer, and I believe its the layer that iOS uses to animate transitions and rotations. So my question is, what could be happening to cause that layer to get stuck, and only get stuck when you rotate 180 degrees (ie. flip the device to the opposite orientation.)
I do not do any custom animations, and I have no code being called on rotate.
Apparently this was related to some code I found to remove the rounded corners on the split-view in-case anyone else has this problem.

Is it possible force UI autorotation in iOS?

I have an auto-rotating view which should be only horizontal at some specific time. I tried changing return value of -shouldAutorotateToInterfaceOrientation: for specific time, but it didn't work as I expected. Because there is no way to force currently vertical oriented UI to horizontal. Is this possible...?
I made a conclusion there is no such thing. I decided to implement rotation manually, myself instead of autorotation. I didn't believed this is possible, but I realized I can do exact things with UIDeviceOrientationDidChangeNotification.
There is -[UIApplication statusBarOrientation] property which looks forces rotation of UI in simulator, but it's just rotating status bar only. However, that's important and preferred for basis for UI orientation by the simulator.
I used it and now rotate everything manually. this is more easier to make and manage.

Resources