How to handle alignment of UI on phone call? - iphone

I am developing iPhone app for iOS 5 or above version, and making use of storyboard for UI design. My problem is when i am on phone call my UI gets misaligned because my upper status bar is taking 20 to 30 pixel of screen space.
How to handle my UI when i am on phone call?

I finally got answer for my question. Following are the things i made changes in my project and everything started working fine.
Took sliced images of all the things needed in my UI. (Initially
i was taking common image to save slicing time)
Made you of autoResizingMask property. It help me save my lots of time. Just make sure only 3 arrows top, left and right one is in ON state and your work is over.
For making everyones search easy i will add following Stackoverflow links to save your time
How to position view below green bar during phone call?
Resize for in-call status bar?
How do I detect a double-height status bar?
How to Remove Status Bar in "View Based Application" - iOS
how to hide status bar in Iphone application
How In-Call status bar impacts UIViewController's view size ? (and how to handle it properly)
iPhone Programming In Call Status Bar
resize content after iPhone status bar is shown/hidden
How to programmatically get iOS status bar height
How is the in-call status bar impacting my CGAffineTransform'd view?
View resize when In-Call Status Bar changes
Thanks to all the people who have replied to all the questions above. It made my big problem resolved.

Related

Xib Size - seems to think its longer than it is

This is a bit of a strange one, but basically I am having a problem whereby the xib size of my initial view controller seems to be longer than the screen.
So, if you have an ad banner set to be on the bottom of the screen... If I run the app in simulator, it does not show on iPhone 3GS/4/4S devices, yet WILL show on the iPhone 5.
I have tried changing the xib size settings, I even created a new xib file, but the same problem is occuring which leads me to believe it is hardcoded somewhere, but I cannot think where to look for this.
It is basically like it thinks the bottom of the screen is about 30-50px more than what it actually is... Hence why the iPhone5 displays ok as it has the taller screen.
Any help would be appreciated!
Its bcoz of the StatusBar. It reserve 20px of screen . You can remove this space by do change in Status bar is initially hidden in plist and set status bar to NONE in IB.
The iPhone 5 has a taller screen. The most flexible way to lay out your xib is via AutoLayout. Here is a tutorial to get you started:
http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2
Basically, you want the ad banner to be contrained to the bottom of the view.

Odd UIBarButtonItem behaviour

Try the following in the simulator or a device.
Create a new Master-Detail application for iPhone or compare any app that uses navigation bars. iOS 5 or 6, don't matter.
In the case of the template: Let it run,create an entry using the plus button and open the entry.
Now touch the area below the navbar directly under the UIBarButtonItem thats leads back.
Even when the button nor the navigation bar is clearly not touched, the button will activate and the view does return.
This is way beyond the 44x height of the navbar.
What is happening here?
Why does this button respond way beyond his frame?
Cant find an info about this in the HIG.
iPhone
The area you can press to activate the back button is actually larger than the actual pixels of the button to accommodate the average thickness of fingers. (The actual number of pixels is buried somewhere in Apples HIG. I think it is 44x44.) This is expected behavior.
iPad
The master view controller is automatically dismissed when you tap outside it. This is expected behavior.

How do I detect a double-height status bar?

The HIG (p.47) says that I have to be able to handle the double-height status bar that appears during phone calls or voice recordings.
How exactly do I handle this situation?
I really only have 1 screen where a keyboard with toolbar over it underlaps a textfield when the double-height status bar shows - on other screens things are just a bit scrunched up but useable.
If I could detect that a double-height status bar exists, I could maybe adjust the placement of the textfields or make them temporarily shorter but is it possible to detect when the double-height status bar is there?
EDIT: Maybe if there were a way to get the absolute coordinates of a known thing, like the nav bar, and if it was +20 pixels off, I'd assume that the double-height status bar is present. Thoughts?
And a secondary question, if this (or anything) works, I'd just like to hide the regular status bar using
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]
but I don't want to hide both - basically a lazy way not to have to touch any of my screens - if the double is there, make it a single again by hiding the regular status bar. Will the above code hide both?
You can monitor these call-backs of UIApplicationDelegate:
application:willChangeStatusBarFrame:
application:didChangeStatusBarFrame:
And it's easy to test this in the iphone simulator: Hardware->Toggle In-Call Status Bar
Depending on your situation, your views and the things in them can resize automatically to fit the space - check the View Size area of the inspector window in Interface Builder on various objects
This issue also occur when user use many other utilities like hotspot. To solve this issue I use following line of code ( as I was myself stuck in this ).
self.tabBarController?.tabBar.autoresizingMask = UIViewAutoresizing(rawValue: UIViewAutoresizing.RawValue(UInt8(UIViewAutoresizing.flexibleWidth.rawValue) | UInt8(UIViewAutoresizing.flexibleTopMargin.rawValue)))
Objective C reference for same issue available here

iPhone UI Offset Issue

I have an iPhone app and for some reason it is moving all the UI elements up the height of the status bar, and they are going under the status bar.
And I have set up the UI with Interface Builder
I answered a similar question yesterday. Likely the solution for you is also similar.
Open up the view's .xib in Interface Builder, and Bring up the Attributes Inspector (Cmd-1). Then make sure the Simulated User Interface Elements setting for Status Bar is not set to None.

Button has moved upwards when running app in Simulator

I have a strange problem when developing for the iPhone
There is one window (in green) and one view (in orange)
when I try to test my app it looks like this in the iPhone Simulator
you can see the view have moved upwards
is this normal? and how to solve the problem?
many thanks
You're most likely adding the view incorrectly. You could post some code and I could give you a better idea, or if you just want a quick fix, open the orange view in Interface Builder, make it 480 px tall instead of 460, show the simulated status bar and relayout your image.
In Interface Builder you can specify the simulated User interface elements. In the screenshots above you will notice in the green one you can see the status bar and the red one doesn't have it. You can turn on these elements by setting the properties of the view. Press Command-1 when you have the view selected and you will see a list of simulates ui elements you can add, these include the status bar, navigation controller bar and a few others i cant remember off the top of my head. This will allow you to position your ui elements correctly when you have these other elements on the screen.
The other issue with your view is that it is not the same height. have a look at the dimensions (cant remember exactly which one but its Command-2, 3 or 4 when you have the view selected) it should be 320x480, i reckon yours is 320x460... (20 pixels, the height of the status bar)