Since Apple is requiring a storyboard launch screen in a few months I went ahead and tried to add one. Adding one is simple and it works just fine but it screws up the layout after loading the app. No longer does a larger screen automatically adjust the resolution, instead I'm left with an SE layout on an 8 Plus screen placed in the top-left corner with the background image repeating (like wallpaper from a 90s website). I'm not using constraints, but I'm not even sure if that's the issue. If so I have a feeling I have a lot of work ahead of me (keep in mind I've never had a need for constraints). A side thought though is, from what I understand, Apple wants all apps to look correctly on all devices... makes perfect sense. But my apps have always appeared correctly no matter the device. So it's ironic that adding the launch screen is breaking my apps' appearances. Is it the constraints? Is there an alternative solution? Or is there hopefully something simple in the launch screen that needs to be changed? Thank you!
Related
I have a game we're trying to release in the app store for iphone and ipad, and while it works fine on all of our devices (a handful of iphones and ipads), when the app store reviewers try it the actual viewport they see is highly cropped and distorted.
This is an example options screen that the reviewer saw:
This is what that options screen looks like for us on an equivalent aspect ratio/resolution:
As you can see, it's just a small, off-centered square for them, surrounded by black. But we've tested this on devices like an old iphone 5 up to big ipads and have never seen anything like this, the game takes up the full screen and the aspect ratio is correct and not distorted or stretched.
One important detail is this is entirely an OpenGL and SDL program, not using any Apple UI frameworks at all. The render size is determined by SDL_GetRendererOutputSize(), which then is used in glViewport(), and the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag. This so far has seemed to work with both retina and non-retina physical devices.
Also all of the screenshots they've given us look the same, same little square viewport surrounded by black, so I originally thought they were cropping them on purpose to highlight specific components of the screen, but this appears to be just exactly how it looks for them as this square is in the same position in each screenshot. I've asked them for more information on their devices but they wouldn't tell me.
We also have the program set to only ever use landscape, not portrait, but the weird thing is that with the way our UI reflows, the only way to get that button to look squished the way it does there is if the game was somehow still rendering in portrait, as seen this example shot I took by forcing it to run in a very tall portrait window:
I don't even know where to begin to try to figure out what's going wrong for them though, because as I've said, everything looks fine when running in an emulator and everything looks fine when we've run it on several physical devices. Is there some build or release configuration I could be missing? Some OpenGL setting I should check? I'm just hoping this problem looks similar to something someone else has encountered before.
If you are on an equivalent device, then another thing that may differ is the accessibility settings. Search for display zoom in settings. Also, try locking the iPad into portrait mode before launching your app to try and reproduce.
Note the little double arrow icon in the lower right corner of the reviewer’s screenshot. I don’t know what that is, but it looks like it could be some kind of screen zoom or accessibility mode. Perhaps they can answer what it does, and how to enable it for yourself.
To follow up with the solution that worked for me, I noticed that in my project's General settings in Xcode, under Deployment Info, I had only checked iPhone and not iPad. What I've since learned is that without that checkbox, some iPads will have to run in an emulation mode, which may have been the source of our problem. Deploying a new build with that checked (as well as "requires full screen"), it rendered exactly the same on our own iPads, but the app was subsequently approved with no further problems. I had made no other changes to the program, so my assumption is that that setting likely fixed it.
So for my app, the tableview layout in the iOS simulator when I click run is CORRECT and as I intend. However the layout is not always 100% the same when I view the layout of the tableview in Main.storyboard. When I refresh Xcode(i.e. quit and restart app), the layout of Main.storyboard is what I intend. However, if I play around with orientations/diff iOS devices within Main.storyboard, and then return to my original device, the layout looks incorrect (even though supposedly the math/measurements are correct). Do I need to be concerned?
For reference I followed the instructions of https://www.ralfebert.de/ios-examples/uikit/uitableviewcontroller/custom-cells/ EXACTLY to make a cell (instead of an image, I used a button though). And here is an image of my iPad simulator https://drive.google.com/file/d/152scJF6h12amh-AAycDqpe6TXOzN2y-H/view?usp=sharing vs the main.storyboard simulator https://drive.google.com/file/d/1NvUfMVLk08S8qH4mFraRsQYbDzPdjaBG/view?usp=sharing
However the layout is not always 100% the same when I view the layout of the tableview in Main.storyboard.
It sounds like you might have some missing or incorrect constraints. Take a look at the little yellow arrow icon to the right of "View Controller Scene":
That icon tells you that there are some issues that you need to resolve. Click it and you'll get a list of the particular issues and your options for fixing them.
Do I need to be concerned?
The risk, of course, is that under some circumstances your view won't draw the way you want it to. Start by fixing the issues that Xcode is pointing out, and then test on lots of different devices (or simulators) as you can, in all the possible geometries you might encounter (different screen sizes, orientations, split view, etc.).
I need clarification on how the container view in Swift 4 is supposed to work. I was under the impression (maybe falsely so), that if I set up all my labels, buttons, etc. inside of a container, set that container to zero for the left and upper constraints, centered it vertically and horizontally in the main view, and then pinned all of the fields within that container, then everything would be proportionally increased or decreased, depending on the screen size.
I designed my screens on a storyboard, using an iPhone 6 sized screen.
The App should be viewed only in Portrait mode, so I needn't worry about dealing with Landscape modes. I am finding out that the text fields within the container are keeping their sized fonts; when going to a larger screen (8 Plus), I am getting a large border on the bottom and right.
When going to a smaller screen (SE), most of the verbiage gets truncated. Have I misunderstood how this is supposed to work, or am I not doing it correctly?
I am almost ready to submit my first App to the Apple Store, but want to make sure that it will handle all possible sized screens. The 2 IOS courses I've been referring to are pretty vague on exactly how auto layout works. Also, I am getting over 24 warning messages that all of my fixed width constraints may cause clipping. (15 yard penalty?).
Hopefully, someone out there will have the patience to explain what I thought should be an easy thing to do. Here are screenshots of my initial view controller using each of the 3 sizes:
Originally Designed Screen, set to iPhone 6
Screen set to iPhone 8 Plus
Screen set to iPhone SE
Many thanks in advance for helping us out,
Jones
Stack views are meant to do exactly what you are trying to do. Here is a version of your app that uses stack views to create the example below. There is also a link to the GitHub page with the code - feel free to use it, tear it apart, whatever. Good luck!
https://github.com/squarehippo/Baseball2.git
I have many layout constraints for a particular app, and in the main.storyboard (preview) the apps look a little bit off, but when I run them in the simulator they look how I want them. So there is disconnect between the two.
I saw the question answered that fixing the constraint warnings would then make the two appear identical.
However, I do not want to try to fix these warnings. A lot of time went into finally figuring how to lay all this out, and I'm worried fixing these (38) constraint errors will screw everything up.
My question is...with the disparity between the preview and the actual device simulation, which one will actually appear if the app is run on a real device? I would assume the one showing in simulation, but I'm really not sure. Is it safe to ignore the errors and the strange main.storyboard (preview) layout it shows me and go with the simulation? It looks how I want it for each simulated device, so I'm weary of changing anything now. Thank you!
According to my experience, Xcode has some problems in storyboard. If you have a constraint which makes a view becomes visually invisible, you will get a warning about this constraint. You can quickly fix it by clicking the warning icon BUT if you close you project and reopen it again, the warning will be there.
The final result should be the UI shown in simulator instead of interface builder or storyboard.
I need your help. I have designed an app to target iPhone only and everything works fine. However, I just realised that when I run it on iPad, I get black spaces around the screen (view doesn't cover full screen of the iPad) and strangely, the bottom part of the app gets cut off when it runs on iPad. How do I get full screen iPad mode without part of the view getting cut off. Thanks
This is normal behaviour(black spaces around the screen) if the value for "Devices:" under Target/deploymentInfo is set to iPhone. In this case you can still test on iPad but with iPhone resolution. (but if it set to iPad you can not test on iPhone).
if you want to get iPad resolution you have to change "Devices:" value to universal.
for (bottom cut) check if your code uses device size for positioning buttons.
Your app must also run on iPad without modification as for
2.10 App Store Review Guidelines
At first, you have to set your the view (on Main.storyboad) to fit all size. That is `wAny hAny).
Then selected the views, add some constrains to them one by one. When you run the app, it should be right. If the position doesn't match your expectation, you can change the constrains. You should know things about AutoLayout. Find some article to read, and practise.
Thanks guys for all the comments. Using your comments and reading and testing AutoLayout features, I am able to solve the problem.