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.
Related
So our app is built using XIB interfaces, not story boards. We have XIBs for iPhone and iPad.
Since the iOS7.1 update the, iPhone xibs are now bigger in interface builder and far too tall when deployed on a device.
The height is all wrong, the XIB is far too tall now. For example, backgrounds appear to go way outside the View when set to fill. When deployed on the phone everything is shifted down about the height of the top nav bar.
If I add/remove Top/Bottom Bars for the View in Interface Builder things shift around but not in a way that makes sense. My app has a nav bar, if I tell the interface builder it has a nav bar then the height of the xib grows a further 80 or so pixels. If I tell the interface builder it has no nav bar, everything shifts up properly but the height of the View is still so tall that backgrounds and stuff near the bottom go off screen.
So for the very vague issue but we are pulling hair over this.
UPDATE
- It seems Opaque Navigation Bar fixes half the problem. We had every interface set with a Translucent Nav Bar. Those do not appear to take up space in IOS7.1 but they did in IOS7.0.
The problem now is still height. It still seems internally the height is broken or starts from a new origin.
In view did load, on a view with a opaque nav bar, on iPod Touch:
self.view.frame.origin.y is showing 0
self.view.frame.size.height is showing 256
Nav bar origin.y = 20
Nav bar size.height = 32
This totals 308, missing 12 pixels.
Create auto layout constraints in IB or programmatically that align the top of the main view in each XIB file to the "top layout guide" and bottom of the views to the "bottom layout guide." This solved a very similar problem when moving from iOS 6 to iOS 7 in several of my apps.
When updating my old program for iPhone 5's 4 inch screen, I found that the navigation controller keeps to its original 3.5 inch screen size and refuse to stretch to fit the 4 inch screen even when its view controller's view and tableview controller's view are all stretch to fit the 4 inch screen. Because the navigation controller's view is not visible during normal use, people may miss it. Because it refuses to fit the new 4 inch screen, when in landscape mode, the screen go beyond the navigation controller's view width and the right button fall off the boundary and becomes unresponsive. In order to show the situation above, I set the navigation controller's view's background color to semi-transparent red and the table view's background color to semi-transparent blue. as shown in the screen shoots below. The question is, how to fix the problem. the plus button are not responsive when in landscape mode, but in portrait mode, it works fine.
Either your navigation controller’s view or, more likely, the window that contains it, are not getting set up with the correct frame. If you’re creating the window in code, make sure you’re using UIScreen -applicationFrame or -bounds rather than a hardcoded (320, 460) or (320, 480); if you’re using a NIB, check your autoresizing masks and layout settings.
I have a label sitting on the the top of screen in a tab bar controller app. When I align it to the top of the screen in Interface Builder (IB for short) and then run it, the label is about 20 pixels higher in the simulator - cutting off half the label or so. I have only seen this behaviour in tabbed apps. I have played with all the align, view mode settings without success and there is no custom drawing code.
Any ideas on why label is misaligned in simulator?
I have attached screen shots of IB (left - OK) and simulator (right - bad):
Thanks,
Serge
I guess , you are facing problem because of the following reason.
Since Tab area occupies some height from bottom,You have design your view such that top of the label should align with the top of the screen(like label should start by leaving some space (20px something) at the top).
Thanks to PJR above for giving the hints. The trick is to setup the 'simulated metrics' of both tab bar controller and each of its first view controllers.
1) The tab bar controller --> simulated metric.bottom bar should be set to none
2) All view controller --> All simulated metric props set to 'inferred'.
I have provided screen shots for a fresh tabbed project created in Xcode 4.3.1 which show what needs to be done.
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.
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.