On my iPhone 6 Simulator (not iPhone 6 Plus) the interface looked stretched. I can't figure out why.
I created a clean new project and started the simulator and there the interface looks normal. Here is a screenshot:
So I copied the storyboard of the new project into my current project and started the simulator with the new storyboard. There it looked stretched up again:
What could be the problem?
I found out what the problem was: There was no launch image (or a launch screen file) provided in my Xcode settings.
If that is the case the iPhone will resize the user interface.
Related
Problem
I have a Controller in Storyboard which has a long UIScrollView inside. Previously it shows perfectly in Interface Builder and now I haven't changed the code. The last time I knew that I updated Xcode to version 11.0. I don't quite know why it fails to render, is it some issue in Xcode 11?
If I compiled, it's success with 0 error and some warning (Which seems me to some Swift deprecated). Even it shows perfectly in Compiled App. I have tried:
Clean Build
Delete Derived Data
Reopen Xcode
Rebuild
Restart OS
Edited after some experiment
Okay, so I tried a bunch of things again and I think I narrowed some problem (maybe?). So my layout show perfectly in iPhone 11 preview, but it fail to render in iPhone 11 Pro Max, iPhone 11 Pro and iPhone 8 Plus preview. Is it ringing any bell?
iPhone 11 screenshot:
iPhone 11 Pro Max screenshot:
iPhone 8 Plus screenshot:
Obviously a change in storyboard previews in Xcode. Seems like it's no longer acceptable to show "simulated size: freeform" greater than iPhone screen height. Changing it to "simulated size: fixed" in Size Inspector solves the issue, and you can now scroll from within the reduced size window in storyboards view...
The app works fine on ios9 simulator and on any real devices with ios8. But on iphone 6 and 6p, when ios upgrade to ios9, the app is stretched and the layout is same as iphone5.
I have also checked the LaunchImage in images.xcassets. There are four launch images:Retina HD5.5, Retina HD4.7(iphone portrait ios8,9), 2x and Retina 4(iphone portrait ios7-9).
I don't know why the app is stretched.
Thank you.
Provide LaunchScreen.xib file for your Xcode instead of launch images. This way you will eliminate your problem for sure. After creation of this xib file, navigate to your project file and to Target -> Info -> App Icons and Launch Images -> Launch Screen File -> select your created LaunchScreen.xib file. Done. Profit.
Inside that viewController in xib file you can put UIImageView with the same images you used as launchImage.
Btw, starting from iOS9 you can substitute your LaunchScreen.xib with storyboard file, but this will work only in new Xcode, as far as I know.
We have an iPod app built with base SDK as 5.1.
App has a tabBarController with three tabs and each tab has a UIViewController to load a different view.
The app works fine for iOS 6.1 and iOS 7 (3.5 inch display) simulator and device but when we run the app on
iOS 7 (4 inch display simulator) or device we are getting black bars at the top and bottom of the view screen in all three tabs.
If anyone can suggest reason for this or some feasible solution to this problem, it would be really helpful for us.
Thanks
First thing is that you must add the required default image for 4 inch screen display. Check Properly in you project have image with name Default-568h#2x.png (640 × 1136 pixels)
This Default-568h#2x.png is Necessary for Support app in 4 inch Screen display
Ones you add this image in to you working Project, Remove old Build from device or Simulatore, clear Project and re build and check Hope you issue will solve.
Edit:-
After fix the black Bar issue you can check the device like my answer Give here check this:-
Detect device type
you have two choice if you can't use AutoLayout
First
Create two xib with same class one for 3.5 inch screen and one for 4 inch screen set using macro with checking which screen appear.
Second
Set Self.view frame using macro with checking which screen appear.
There are also other methods you can use for set self.view frame as using window frame or UIScreen
My problem was I accidentally deleted the value found here:
I added back LaunchScreen, and made sure there was a LaunchScreen.xib. Maybe it will help some others.
Ive had the same problem - black bars at the top and bottom. It was simply solved by setting the drop down in "App Icons and Launch Images" to Main_iPhone:
App Icons and Launch Images Screen Shot
I was facing same problem . I just added launch image and it worked for me.
XCode->Click on Project File -> Select Target-> App Icons and Launch Images -> Add launch image source
This worked!
Pay attention to Step#5 and Step#6 below:
1.In xcode, Click on the Project file in Project Navigator
2.Click General tab
3.Type "Main_iPhone" in the Launch Screen File field
4.Save
5.Remove the app from device or simulator
6.Then in Xcode go to Product Menu and then select Clean
7.Build again
I have made a new app with storyboard, where the storyboard is currently just for iPhone 5. But the issue is, when I run this on iPhone 5 device/simulator, it shows padding at the top and bottom of the screen as if an iPhone 4 application is being run. Please see the screenshot I have attached. And help where did I go wrong.
EDIT : Actually its still not working. In iOS 8 its coming fullscreen but in iOS 7 for some reason the black padding is coming. PLease hellpppp.
EDIT - I got the issue.Apparently, in xcode 6, when Launchscreen.xib is given, it does not work for ios 7 and it works perfectly normal for ios8.
Previous answer - The issue was, in Xcode 6.0, the new project generates a LaunchScreen.xib file, but apparently you manually have to go to the General settings for the target and select the launch screen File options from the drop down. This solves the issues. :)
I am designing my iPhone app using storyboard and auto-layout. Everything works fine in iOS 7 on both 4 inches and 3,5 inches device.
On iOS 6.1 the app runs like is always on 3,5 inches device, even if is running on a 4 inches device, the black bars on top and bottom appears.
screenshot on the simulator:
Anyone with the same issue? how can i solve this problem?
I think are you Forget to adding splash screen Default-568h#2x.png in to you Project please check Property and set required splash-screen Default-568h#2x.png (640 × 1136 pixels)
Ones you add this image in to you working Project, Remove old Build from device or Simulatore, clear Project and re build and check Hope you issue will solve.
Yes, i'm agree with Nitin. In XCode 5 just create e new LaunchImage Set and add the standard, retina and R4 image in both iOS version (5,6 and 7).
Remember to set this set as default in your project info.
A quick fix is to replace Launch Images with your Storyboard.
In Xcode, go to Target > General, and then: