on iPhone X, UIApplication.sharedApplication.statusBarFrame.size.height is 20.
As you know, on iphone X statusbar height is 44.
Because I set statusbar background using UIApplication.sharedApplication.statusBarFrame.size.height, there's weird blank white rectangle between statusbar and the contents.
But if I set background height 44 manually, that white rectangle disappear.
I cannot understand why UIApplication.sharedApplication.statusBarFrame.size.height is 20 on iPhone X. Do I need to do something else to get statusbar height correctly on iPhone X?
I noticed this too while testing my app on iPhone X. In my case I resolved this issue (status bar height became 44) by using LaunchScreen.storyboard instead of Launch Images. But in general it can be caused by lacking of a launch image with appropriate size for iPhone X (1125px × 2436px), if there is no appropriate launch image, also black stripes may appear at top and bottom of the app.
Related
This question already has answers here:
Seeing black bars at the top and bottom of the iPhone X Simulator
(11 answers)
Closed 5 years ago.
I'm trying to adapt an app to run on the iPhone X's screen but the UIScreen.main.bounds.size is always returning 375x667 and it should return 375x815.
I am running on a iPhone X simulator and everything works fine, except for this, so I am having a hard time on positioning elements on the screen as the wrong height is read.
I forced the height to be 710 just to see how it behaves.
Take a look at the picture and you will observe 2 crazy things:
The banner is cropped by the black area;
The corners of the app are rounded even with the black stripes.
You need to add Launch screen for iPhone X. Which size is Portrait size 1125px × 2436px & Landscape size 2436px × 1125px
Hope it helps!
I'm wondering what the correct sizes are for
1) setting a background image for a UIView on various iPhone devices, including Retina, 4s, 4, etc..
(does the version of iOS matter?)
2) setting a background image for the UINavigationBar, again on those various device versions/os versions
Lastly, how should one go about naming these files. I know that Apple is very strict about naming an image with a #2x.png, with specific names, etc.
If there is documentation that somebody could point to, that would be great as well. I couldn't find anything on the dev website...
Thank you in advance.
iPhone and iPod Touch Screen Pixel and UI Component Dimensions
Notes:
Retina Dimensions are given in parentheses.
All pixel dimensions include highlight or stroke effects. For example, a 30-pixel high button is actually a 29-pixel high button with a 1-pixel highlight on the bottom.
iPhone screen size:
Portrait 320×480 (640×960) pixels
Landscape 480×320 (960×640) pixels
iPhone Nav bar:
Portrait: 44 (88) pixels high
Landscape: 32 (64) pixels high
iPhone Nav bar buttons:
Portrait: 30 (60) pixels high
Landscape: 24 (48) pixels high
iPhone Nav bar button icons: About 20×20 (40×40) pixels (when in Landscape mode, it shrinks the 20×20 (40×40) pixel icon)
iPhone Toolbar: 44 (88) pixels high (does not change)
iPhone Toolbar button: 30 (60) pixels high (does not change)
iPhone Toolbar button icon: about 20×20 (40×40) pixels
iPhone Tab Bar: 49 (98) pixels high (does not change)
iPhone Tab Bar icon: about 30×30 (60×60) pixels
iPad Pixel Dimensions:
iPad screen size:
Portrait 768×1024 (1536×2048) pixels
Landscape 1024×768 (2048×1536)
iPad Navigation Bar and Tool Bars: 44 (88) pixels high
iPad Nav Bar and Tool Bar buttons: 30 (60) pixels high
iPad Nav Bar and Tool Bar button icons: about 20×20 (40×40) pixels
iPad Tab Bar: 49 (98) pixels high
iPad Tab Bar icons: about 30×30 (60×60) pixels
iPad List View: 320 (640) pixels wide.
Follow answers in this link for the basic naming standards for the newer devices. iOS version shouldn't matter, but hardware does.
EDIT
Wow, literally found all dimension on this site Check it out, it has pictures!
Another useful link here.
I have an app that I can't update for the new size of the iPhone 5- basically it's built around the asset sizes I have, and there's no way to get updated assets. The app still works fine, but it has a solid white background, and the letterbox (the black bars at the top and bottom) is black, which is really ugly.
Is there any way to set the color of the letterbox to white?
Well, you could just have google searched it. "You cant!". But there is a workaround. All you have to do is just add a "Default-568h#2x.png" file. You app will fill the display. All you have to do now is just add a white graphic on top and bottom if the device is iPhone5.
No, there is no way to do that :) But, you could resubmit your app without using updated assets and support iPhone 5 screen. To achieve that, 1) you have to add iPhone 5 launch screen. 2) make your view and subviews resizable so that they appear on their places (No need to create separate nibs) 3) test with iPhone 5 (iPhone 5 simulator), and you are good to go ;) Good Luck!
I am using Default.png for iPhone and Default-Landscape.png for ipad. But in case of ipad the splash screen shows only half of the image and rest is cut. It seems to be the size of image becomes double of what it should be. I am using image with width:525 and height:175 for ipad.
I also added:
UILaunchImageFile~ipad Default-Landscape.png
in my info.plist file. What might be the problem? Please guide me....
Also can i set the backgroung of splash screen to white????
The landscape iPad launch image has to be 1024x748 pixels. That's the only size that will prevent your image from scaling.
I guess the iPad tries to scale your image to a height of 748 which means the width will be 2244px. Not exactly double but something like four times the size of what you want.
Create a white image with dimensions of 1024x748 and put your 525x175 image in the middle of it.
Try the image name Default#2x.png and size would be 1024X768....
I have a splash screen in my app which is working fine other than the fact that the image seems to stretch slightly vertically when loaded.
The image is 320 x 460.
Any idea why the stretch is occurring?
That's because the splash screen size should be 320 × 480 (esp. if the status bar is hidden).
(You should also prepare a 640 × 960 one (Default#2x.png) for iPhone 4. You need to provide 2 or 3 more images if you need to support iPad as well. See http://developer.apple.com/library/ios/#qa/qa2010/qa1588.html for detail.)