iPhone App Phone Call Situation - iphone

When a phone call occurs, my app moves down, and the bottom of the app is cut off slightly. Is there anyway to shrink or resize that whole view when a call occurs.
Preferably through interface builder.

Indeed, your application window does shrink its subview. For example, if you have a status bar so the frame of your root view is (0,20,320,460), then if the in-call status bar is on, then the frame becomes (0,40,320,440).
Then why does the bottom of your app seem to be cut off? It's simply because the root view autoresizes its content in that way. For example, its autoresizingMask property says it has a fixed top margin and a fixed content height. So,
If you want to 'squeeze' the view, try fixing both top and bottom margins and having flexible content heights.
If you want the in-call status bar to look as if it goes over your app, fix the content heights and the bottom margin, and have a flexible top margin.
If you have a fixed top margin and a fixed content height, then your app will seem to slide down.

Related

How can I make ScrollView full screen? I placed the necessary constraints, but it doesn't work

I'm trying to make a ScrollView so that its size adjusts to the size of the text. I placed all the necessary constraints
, but when the application is displayed on the simulator, the content view starts from the safe area and also ends up to the safe area. Although I have pinned scroll view to superview and content view to scroll view.
I want the content to start not from the safe area like here ,
but from the start of the screen like here
in other words, I want to remove the blue bar from the top and bottom
Do you have any ideas how to do it?
Sometimes UITableView & UIScrollView can still show safe area even though you attach your View to top of Super View. You just need to add one line to solve this issue but make sure your ScrollView is connected to superView not safe area at the top.
Add scrollView to your ViewController and in viewDidLoad() just write:
scrollView.ContentInsetAdjustmentBehavior = .never
Check this answer for further details: Make UITableView ignore Safe Area

Auto resizing in a tab bar is not working

I have a view with a tab bar and a navigation bar. I have a few buttons and textfields in the view. I have some empty space left at the bottom of my view.
While testing on 3.5 inch screen the empty space is occupied by the tab bar. But, on a 4 inch screen I can see the space left clearly. I tried auto resizing every way but it's not working.
Should I go for creating a separate view for the 4 inch screen?
While working with tab bar you dont have to bother for leaving space for tab bar, it'll make it's space by resizing (not cropping) the height of your view. In result the screen size will minimize.
But in this case view's AutoResizingProperty Must be like:
[yourView setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
Or if you are dealing with XIB then it should look like:
With these setting your view will resize itself on bot size of windows.

Navigation bar and UIWebview

I am having some slight issue and trying to fix it but can't find the easiest answer towards it. I have a navigation bar, which is taking top pixels away, and hence the webview content last 44 px if I am not wrong goes under the bounce and hides the content. Hence the problem is that I have a submit button, and since it needs to be clicked, it goes under the bounce condition and doesn't let me select the button. Any quick solution to this problem will be appreciate.
Thanks
Make sure your UIWebView has the autoresizingMask set to be flexible in height and width. You can do that in interface builder or in code.
You can set the bottom content insets to 44. But it seems your view is not put correctly (web view size does not take navigation bar into account, web view is not resized properly, etc.) I would fix that instead of patching with the insets fix.

How do I set the right margin of a UITextView?

I have a vertically-scrolling UITextView that fills the width of the screen. I need the text view to have margins (contentInset) of 20 pixels on the left and the right. But for some reason, I can't get the right-hand margin to work, either in Interface Builder or in XCode.
The reason I can't just make the text view narrower is because I am adding a subview which needs to run the full width of the screen. Also, I can't turn subview clipping off, because it plays havoc with a load of other elements on the screen.
Anyone know why the contentInset property is not affecting the right margin?
Thanks!
You could add an intermediate view that can be the superview to your text view and what was previously it's subview.
New View with Frame(0,0,width,height)
->TextView with Frame(20,0,width-20,height)
->Subview with Frame(0,0,width,height)

Toolbar placement off with Interface Builder

I have a view xib that I'm manipulating through IB (for various reasons) and it will be launched as a modal view in code. I have a Toolbar at top and another one at bottom with some other UI elements in between. When I run the app, the placement of the top Toolbar isn't as I see it during the layout in IB.
In IB, the top Toolbar is placed at top below the status bar correctly and the next UI element (a label) appears below it. However, in the simulator, the top half of the Toolbar appears underneath the status bar and thus making it look cut off and there is a lot of space between the Toolbar and the label, which isn't reflected in the layout in IB.
For modal views, should the height of the view be different? If so, what does it need to be?
The view's height is set to default height value of 480.
Is the style of the status bar set to Translucent Black in IB? This causes the status bar to not consume any space and as a result "float" above the underlying Views.