I have an iOS App originally developed for iPhone 4 and 5.
After doing some updates, I tried to run it on iPhone 7 (Simulator), the Views won't fill the screen any more. They (inclusing the title bar) leave a black margin on the right and the bottom of the screen.
I found a lot of similar posts regarding iPhone 5, where an appropriate launch image was missing. Yet, I have included all possible launch images in their correct sizes as asset catalogue (shows no warnings any more, puh), and the when the app is launched, the launch image is fullscreen.
The Layout/View is set to auto-layout, and resized well, if I change the size in the InterfaceBuilder.
Why does the View not scale on iPhone 7 ?!?
Try to add splash screen image to project with following name instead of assets folder.
Default-568h.png 320 x 568
Default-568h#2x.png 640 x 1136
Default-667h#2x.png 750 x 1334
Default-736h#3x.png 1242 x 2208
Default.png 320 x 480
Default#2x.png 640 x 960
Found Solution
In the View's "Attributes inspector" tab, in category "Simulated metrics", the attribute "Size" was set to "Freeform". After changing this to "Inferred", the sizing worked.
Note, that this seeting shall be checked in the MainWindow, as well. And it may require a build-clean, before this change reaches the Simulator.
Changing the "Size" also influenced the device selector in the InterfaceBuilder (the symbols for different iPhone and iPad models), making it actually adjust the size when clicking an iPhone model or changing orientation... Before, nothing had changed when clicking a model from the selector.
yes that was also working but in this question launchscreen are mentioned so i have gives answer according to that point.
Related
I have inherited an app that uses separate Storyboards for iPhone and iPad. Neither uses autolayout. In viewDidLoad() I log the value of UIScreen.main.bounds.
For any iPhone (5s through X) the logged size is 320x480. This does not change after viewDidLayoutSubviews().
When I create an app from scratch, I get the expected sizes (e.g. 375x667 for iPhone 6 thru 8).
What could be different in my hand-me-down app that makes the screen size uniformly the ancient values for 1x iPhones?
Please note this has nothing to do with view resizing -- this is the screen we are talking about. Similarly the screen scale plays no apparent role.
When you create a new project, if it comes with a Storyboard for Launch images, the size will be automatically detected..
However, for older projects that uses Image Assets instead, you need to provide sizes for the launch screen. IE: "Default" images of the correct sizes of the screen as per:
https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/
Static Launch Screen Images. The names shall be: "Default-XXXh#ResY.png"
where XXX is the height and Y is the resolution.. Example:
iPhone 6 Plus - 1242px x 2208px - Default-736h#3x.png
iPhone 6 - 750px x 1334px - Default-667h#2x.png
I have a very old xcode/objective-c iOS project.
I tried to compile it on the lastest Xcode version and it works fine.
On big iPhones, the application is streched to fit in bigger screen.
I tried to create a new Xcode projet and drag all my source files in the new project. I removed storyboard.
It works, but the application is not stretched. I see 2 black bands at the top and the bottom of the screen.
What i want is just to understand which parameter i have to changed in the project.
This is not a storyboard or size classes issue because i have no storyboard or xib files. I tried to change iOS version déployment target.
Thanks
You need to add a launch image for the large screen size of the plus models or better a launch screen file.
See: here
Add launch images of of accurate sizes as follows for iOS 8 and later.
Goto launchScreen in the XCAssets, you can see these options on the right pane see the image attached.
and add images with size :-
Image type Size
Retina HD 5.5″ 1242 × 2208 pixels
Retina HD 4.7″ 750 × 1334 pixels
We have an app that is made for iPhone 4/5 and iPad/iPad Retina. The interface XIB files for iPhone do not use dynamic layout, and the code that places UI elements assumes a screen width of 320 points and a screen height of 480 or 568 (iPhone 5) points.
Due to a lack of time, we currently can't adapt the app for iPhone 6 and iPhone 6 Plus the "right way" (by changing the XIB files to use dynamic layout, and changing the code to work with variable screen widths/heights, then testing all the UI positioning again). But we easily can generate higher-resolution versions of the images.
I've experimented with the following: I don't add a Launch Image for iPhone 6 / 6 Plus; as a result, the app simply runs upscaled on an iPhone 6 Plus, and the screen still has 320 x 568 points. Everything runs fine, but the graphics are very blurry.
However, if I load a higher-resolution image (e.g. 1242 x 2208 pixels for the background) and set an UI element to use this image, then the image is sharp. (I'm testing with the simulator; don't have an iPhone 6 Plus available; I hope the behaviour is the same on a device).
Instead of adding the above workaround for each image individually, what I want to do is: at the start of the app, check the model of the device, and in case of iPhone 6 Plus, tell the app to use a custom image suffix. This suffix should be used for all images, not only those that are loaded via code, but also the images that are specified in XIB files. Is this possible?
Don't complicate yourself. just like retina with suffix #2x, you have to add #3x for iPhone 6 Plus.
I'm developing an app and have come against a strange issue I can't find the answer for - when testing the app on an iPhone 5 the whole app display window is shrunk down to what looks like a 3.5 size display (the top and bottom of the screen are black and even the status bar is pushed down). When I test the app on an iPhone 5s running iOS 8 it displays full screen as expected.
Also when testing in the iOS simulator for iphone 5, and 5s it displays as expected. I'm using xcode 6 for development.
Any help would be greatly appreciated.
You need to set splash screen for your app. Otherwise it will take 3.5 screen size.
Just set the splash screen and you will be done.
So from iOS8, you can use a .xib as your Launch image, but if you have to support past versions of iOS, you have to provide static SplashScreens.
here is a link about replacing the launch image with a .xib file
If you have to use static Launch images, you have to add every supported resolutions:
320 x 480 - not retina iPhones
640 x 960 - retina 3.5" iPhones
640 x 1136 - retina 4" iPhones
750 x 1334 - iPhone 6
1242 x 2208 - iPhone 6 Plus
use size class approach on any height and any width. Hope you will get your solution from the following link
http://captechconsulting.com/blog/tyler-tillage/ios-8-tutorial-series-auto-sizing-table-cells
just clarify on the other answers, make sure you also set the 'Launch Image Source' under 'General' -> 'App Icon and Launch Images'
screen shots....
...mine used to be....
...and i changed it to... (and set an image)
GLHF!
I have an app that was created prior to the new iPhone 5 retina widescreen device.
Now i am trying to support this high definition widescreen.
I adjust the main ViewController and the main window XIB files so that they are set to Autolayout. I can verify that the width/height displayed via the IB shows 320 x 568.
However, when I run in simulator, i can see that the height is still 480.
The code im using to print the height (and width) is in the main view controller's viewWillAppear method:
[UIScreen mainScreen].bounds]
Why is the size.height still 480 instead of 568?
You have to add the iPhone 5 Launch image (Default-568h#2x.png) to your project.
The 568 point tall launch image tells iOS to launch your app in 4" mode. If you don't have this image, your app is treated as a 3.5" app. Even if it is 4" compatible.
Point worth notice - in new Xcode you have to add this image file Default-568h#2x.png to assets