I'm working on an app and I want to make it full screen, but when I hide the status bar I get an offset of 44px (status bar size).
With status bar the buttons are on the line:
http://i55.tinypic.com/xlbjsz.png
Then I've set in the Info.plist file "Status bar is initially hidden: YES"and I get an offset: http://i55.tinypic.com/2up3ceo.png
And when I uncheck Autoresize subviews I get this:
http://i54.tinypic.com/2h821r4.png
I've put on all xibs status bar to none, including window.xib, I don't have any ideas left, please help me.
From the images you uploaded it seems everything works as it should. When you hide the status bar your view will shift up the amount of pixels that the status bar was previously using to display itself.
So if the views size is 320 x 460 when the status bar is shown (the status bar has a height of 20px so if you add that up it will make it 320 x 480 the full iPhone screen size) when you hide it your view will have a new size of 320 x 480.
As you said by default your view will autoresize the views inside and when you checked it out it's only normal to get a 20px gap at the bottom of the page.
Please keep in mind that on a retina display (iPhone 4) all these sizes are doubled, so you actually get a 40px gap at the bottom.
Related
I'm so confused. I don't have a status bar, and I don't know how to make my scroll view's dimensions. Is it 320 x 480, or 320 x 460? Because when I drag it out onto storyboard and it fills the entire screen it says it is 320 x 460, but then when I add subviews to it they get positioned strangely and so that it's like the views are 20 pixels short or something.
EDIT: I'm just a little confused because when my status bar goes away, it doesn't re adjust the view size, it just makes the view 20 pix shorter, which doesn't really make sense, right? Shouldn't it make it 20 pix longer instead of just cutting off 20 pix?
The iPhone screen is 320x480 definitely.
The reason you're having an issue in storyboards is there are multiple places to tell it you don't have a status bar. You need to track down all of them (3?) and make sure it says no status bar.
The most common problem is that you have your status bar either on or inferred in one of your earlier viewControllers while you've exclusively set it to off in a nested viewController. This causes it not to have a status bar but show itself as 460 pixels high. as you can see in the image its clearly 20 pixels shorter. Thats because the segue is telling it that when its presented to present it "under" the status bar even though it doesn't have one itself. If I were to change the segue from a modal to push the problem goes away. Or if I set the first viewController to have no statusBar as well the problem goes away. Also note that Xcode can require a restart to properly update its graphical storyboard in some instances.
One More Thing
Also setting either in code or storyboards to hide the status bar isn't the same as setting the UIStatusBarHidden to YES in your .info file. If you left it to no while hiding it everywhere else your default.png will be clipped and show the status bar while loading then it will disappear once the app finishes launching. So be sure to hide it there as well for a consistent user experience.
Code
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[application setStatusBarHidden:YES];
}
it is 320 x 480, the 20 pixels you are seeing is the status bar, if you are planning on hiding the status bar and want to match the size in Interface Builder, you can go to IB to Simulated Metrics -> Status Bar and select None.
This will not affect the real size of the view in your view controller, though as it will resize itself to fit in the size even if you set the view to be 320 x 480, the view controller will resize itself to 320 x 460 if there is a status bar and 320 x 418 if there is also a navigation bar.
I am a bit out of iPhone-programming, but this 20px should be the upper border, where you can see the carrier and strength etc.
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.
My application support to display some screen in landscape mode, and in landscape mode, I set to hide the status bar to get mode space to display data.
The problem is while hiding the status bar and rotate screen, it leave a white pace at status bar position until the screen is rotated completely as below screenshot.
I guess that steps of operations when rotating screen are:
1. hide status bar
2. rotate screen
3. resize screen to take place of status bar.
So until the screen is rotated completely, user still can see the white space, it is not good and I want to do something such as: set color for that blank space to black, or set animation to hide that blank space but unlucky!
So, does anyone have solution to resolve this, please help me, thanks a lot!
you should make the size of view 320 * 480. as you might have hidden the statusbar but the size of view will be 320 * 460(default)
Check out this one.
I have a UIViewController which creates it's own view. It's a fullscreen image at 320 x 460 size. But for some reason that image seems to be placed below the status bar. I guess I could set some autoresize mask, so that this view is automatically placed below the status bar? (I mean not exactly below, but 20px down... so not covered...).
Go to the alignment controller and make your controller stick to the bottom of the view I steed of the top
Shouldn't it be 460 when the status bar whose height is 20 is shown?
So it turns out that the status bar is ON the main window instead of ABOVE it?
In contrast, view height is set to 460 in IB when status bar is turned on.
Depends how you're setting up the window. If you set its frame to [UIScreen mainScreen].bounds, you get the full 320x480; if you use .applicationFrame, you get 320x460 (or 320x440, if the status bar's double-height, as when the user's in a call, making a voice recording, or using tethering or Nike+).
The status bar is ON the mainWindow. Views that you create on mainWindow, can extend under the status bar or abut it.