Xcode 10 - iPhone X black bars [duplicate] - ios

This question already has answers here:
Seeing black bars at the top and bottom of the iPhone X Simulator
(11 answers)
Closed 4 years ago.
I have been searching for days now and I am really going crazy.
I have re-openend an old project last edited with xcode 9 (I did not care about the iPhone X screen until now) in my freshly updated Xcode 10.
No matter what I do I can't get my app to use the whole screen for iPhone X.
At first I noticed I was not using safe area layout guide - ok, added it for a test view, still black bars.
I'm using storyboards and have set up a test storyboard with no view controller or something else, only a single view inside the safe area and yellow background. This storyboard I have set to be the main interface.
In project settings I have enabled "Requires full screen".
In Xcode Editor everything looks good:
However, the result in simulator (and also on a friends real iPhone X) is like this:
Is someone able to help? This does NOT happen when I create a new project, but of course I would very much like to avoid using this option as the app is almost completely developed....
Thanks,
Matt

Thanks to rmaddy I changed from launch screen image to storyboard and the problem disappeared... how stupid of me to ignore that while googling.. :)

Related

Center a UIView inside a TableViewCell

I've been facing an weird issue which I have never experienced before (pretty new to iOS). I am trying to develop a blog reader app and I am using a UITableView inside my main View. Within the TableView I have added 1 prototype cell and modified it's height to be somewhat bigger.
In order to create a "floating", "shadow" or "card" effect within the TableViewVell I have added another View which will contain a cover image and a summary.
The problem I am facing is related to the layout that is displayed by the Preview Assistant for Storybords.
Even though for iPhone 8 (xCode 9.1) everything looks fine based on the constraints that I have put in place, for iPhone SE and 8 Plus things look weirdly different even though during the simulation things do not really look as described.
I have watched WWDC Videos, YouTube Videos, even some great tutorials but none seem to go beyond the basics and actually cover this issue that I am facing.
Here is a screenshot:
XCode Storyboards Preview
I made a simplified demo ofthe project which can be checked out on GitHub:
https://github.com/sebastiannitu/ConstraintIssues
I would very much appreciated if seomeone would calrify this issue for me once and for all. I am sure it's just me doing something silly but I cannot really waste any more time with this. I've already invested about 2 weeks in trying to figure this out!
Thank you very much for your replies in advance!
It's a mild bug in Xcode, but no big deal. Do this:
Change the device type in the canvas, e.g. to iPhone SE.
Switch away to your code, e.g. ViewController.
Switch back to the storyboard. Notice that the constraints have now fixed themselves in the canvas!
Show the Preview for that device type.
So it's mildly annoying, but it does work. Here's the preview for the iPhone SE:
Here's the preview for the iPhone X:
your constraints setup is fine . problem is with only assistant editor. if you run it in your simulator, View (orange View) will resize currectly.
Here is the screenshot for orange View, when running in iPhone 8s (left) and iPhone 5s.
i am not uploading project, but if you have problem then let me know.

iOS Application screen sizes have black bars on some screens at top and bottom [duplicate]

This question already has answers here:
iOS 9 Xcode 7 - Application appears with black bars on top and bottom
(17 answers)
Closed 6 years ago.
Recently I've upgraded to XCode 7 and have been having some trouble with screen sizes on my application, mainly black bars the appear at the top and bottom of the screen.
I've read through similar threads and implemented the fixes suggested which was adding a launch screen image and that worked for my iPhone 6's size but when I try running the simulator for the iPhone 6+ the black bars at the top and bottom of the screen are still there.
Also the screen wont resize for smaller versions either and parts get cut off or go off screen.
Any help would be greatly appreciated, thanks!
I ran into this problem last week updating an old app. Adding a launch screen image won't entirely solve it. Instead, you need to create a new launch screen.storyboard (File -> New -> File -> User Interface Tab (on the left) -> Launch Screen
Then in your project settings, set your launch screen file to the .storyboard file you just created. This should automatically fix the black bars.

iOS Universal app seems slightly zoomed in on phone

I have an iPad app that I'm converting to a universal app to show on phones. It has both a tab bar and a navigation bar, and my problem is that they are both way too big on the phone. I could swear I heard Paul Hegarty (from the iTunes U class from Stanford on Swift app development) mention a switch or trick somewhere that would cause the bars to adapt to the iPhone, but I can't find it.
Here are screenshots of my apps bars, vs the Photos app in the iPhone 6 simulator to show what I'm talking about.
Not a huge difference, but significant on a small phone screen.
My fonts are also way to big, which is confusing since I have them set to the system "headline" or "body" options for all size classes, but that may be a separate issue.
Any help is greatly appreciated!
App written in Swift, using storyboards for iOS8, btw.
Edit:
The more I look at this, the more I'm convinced it's not related to the bars, but the entire app - the fonts and everything. The whole app appears to be zoomed in to 120%, which is subtle, but looks really bad and wastes space.
I have also now seen this in a second app - the Apple DateCell sample. It also appears 'zoomed in' when run on the iPhone 6 simulator.
Edit 2:
This effect is even more exaggerated on the iPhone 6 Plus simulator - everything is even more 'zoomed in' looking - the top and bottom bars are almost twice the height they should be. This can be seen by downloading the Apple DateCell sample and running it.
Edit 3:
ARGGGG, all this time wasted, and it was due to the launch screen image - why on earth would a launch screen image not being set cause the entire app to scale?
I finally figured this out - it was related to the launch screen image. Apparently if it's not setup right, the whole app scales on the iPhone 6 and 6 Plus for some reason. This question is what pointed me to the answer.
For me, I had to both create a LaunchScreen image in Assets, and set it in the project file, and ALSO select the launchScreen.xib as the Launch Screen File in the project. I don't have a real launch screen yet, so these are both just empty or defaults in my case.

How to make app compatible for 3.5" and 4" retina display [duplicate]

This question already has answers here:
iOS 6 apps - how to deal with iPhone 5 screen size? [duplicate]
(8 answers)
Closed 3 years ago.
I have checked all relavent questions. Didn't find anything useful or may be I was not able to understand. I am newbie and just prepared a simple app.
App looks good for iPhone 5 screen as you can see below:
But on as I turn it 3.5 screen mode. It messes up with the element on the screen. as you can see below
Can anyone help me how to fix it or just making two version of app is the best solution of this problem.
Any help or suggest would be truly appreciated.
Use the size inspector (option command 5). The autoresizing area is what you're looking for. The red box represents the selected object and will show where the app will place and stretch UI element relative to the window. The I shaped outer arrows show it's anchor point. The arrows in the middle show how the object will be stretched vertically or horizontally.
There are two ways you could do this. One way would be to create a second xib or storyboard file for the different screen size. However, Apple added constraints to make it so you don't need to have a second file. To edit the constraints, click on the ruler tab when editing the storyboard or xib. You will find the constraints on the bottom. For more help with constraints, you might try this tutorial.

iOS XCode Storyboard controls moved and now look strange in simulator

I am following the course on iOS through iTunes university and working on the calculator project. I moved the controls on the storyboard to make room for another control at the top. Everything looks fine on the storyboard but when run in the simulator, controls are bunch up, on top of each other, and some are clearly off the top of the simulator screen. This leads to the following very related questions.
How does one move controls around on the storyboard? I went to the size inspector of each control (buttons in my case) and changed the 'Y' value (increased it by 10). I did this for each control. I didn't think about it as I was doing it because as I said, all looks fine on the storyboard. Is there a better way to move controls around? I could not figure out how to grab more than one control at a time and move them. Grabbing all and moving or all but one and moving would have been ideal.
I anticipate someone is going to say, "We need more info. " How do I show the storyboard? Is there a xml file somewhere? How is the storyboard saved? How should I show the results of the simulator?
In general, what the heck is going on? Why would things look so different in the simulator?
Is there a better forum/group to ask newbie questions about iOS programming?
My specs are these:
XCode 4.5.2
Ios simulator versions set to 6.0 and iPhone
Any other info needed? Thanks in advance,
Dave
Try setting your simulated device size to 'freeform' instead of 'inferred'. This screen is a bit smaller so the controls are no longer overlapping. The latest xcode sets it by default to ios6 (screen size of iPhone 5)
edit For a better insight in xcode IDE, please refer to the documentation provided by apple (includes screenshots for clarity)
https://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/000-About_Xcode/about.html#//apple_ref/doc/uid/TP40010215

Resources