swift storyboard screen not equal phone screen, XS MAX - swift

Having a hard time finding an answer for this.
The storyboard doesn't have the "view as" option for my iphone (xs max), so the screen on the storyboard always ends up butchered when i launch the app (the labels dont end up as they're seen in the swift storyboard). Am i missing something really simple?

It seems I don't have the XS Max as a selectable "view as" option either. However, the reason you're having this issue is because of something called Autolayout. Autolayout allows you to set constraints for all your UI elements, keeping the UI's integrity across multiple devices. If you set constraints for each element on the screen, you'll solve this issue.
If you're unfamiliar w/Autolayout, learn more here

Related

Xcode 11 Safe Area Does Not Go FullScreen

Since I am using Xcode 11 I am having problems with the Safe Area. My App is an ArKit- App that uses an ARSCNView. after upgrading to Xcode 11 the safe Are doesn't allow me to display it full screen anymore. Actually all the views in all ViewControllers can't be displayed in full screen. I really don't know where to start. Did anyone experience this kind of behavior?
Thanks!
Edit:
I unchecked all the necessary boxes I hope. The behavior I still get is this:
Storyboard Main
Inspector
Live View
There seems to be a view underneath. But I never added one and the inspector doesn't show. This changed with xcode11.
I just found out what happened to my ViewControllers. I am checking for internet connection with a LaunchViewController. The segue from this controller to the next one did not specify "full screen". I still don't know why I have to explicitly tell the segue to do so in Xcode 11. But in the end that solved my problem.
Thank you
The Safe Area is used as a reference for constraints for views and objects that you want the user to be able to interact with. It is used as a guide during the layout of objects on the screen. If you want to take advantage of the entire screen, constrain your views to the superview (basically the main view of the view controller). This is handy for displaying things like backgrounds on the entire view. Take a look at Apple's human interface guidelines for more info:
Apple's Human Interface Guidelines: Adaptivity and Layout
Similar Question:
iPhone X - Safe Area does not achieve full-screen experience?

How to set the length of a constraint from a sub view to a parent view by the parent views percentage in Xcode

Preferably using storyboard.
This is another one of those things you would imagine to be so simple it shouldn't be thought of.
The only way i know how to add a constraint to a subview is in storyboard i click on the constraint button on bottom left. However, the only way to set a constraint is by constants which make no sense because the resolution of apple devices change. So if you were to put a constant constraint of one subview to 50 for example on an iPhone 5s and everything looks good, on an iPad everything is way off which thinner and/or thicker spaces.
You would think percentage would be the main way to go and constants should be more difficult to access.
Anyways please let me know how to do this. In the answers found online i only saw ways to do it in code but i would like to keep it all in story board if possible.
Thanks!

xCode, Swift: working with vs. working without storyboard

I'm new to programming apps, trying to realize a project for iOs using xCode and swift.
As far as I've learned most people seem to work with the storyboard feature, but I've come across people that suggest to deactivate the storyboard and work with code only.
I'd like to know your opinion on what method fits my needs best for the intended project. As I am just getting started, I'd like to stick with the appropriate method right away for I'm probably going to invest a lot of time.
This is about what the app is going to look like:
myApp Layout
Now this is what it' basically supposed to do:
The "settings"-button (blue area, top left) is going to take you to a different view to set preferences. The "search"-button (blue area, top right) is going to change the title into a search field.
You can browse through 3 categories. Each of them contains a couple of questions. Those are stored in a database and are supposed to be displayed list style within the red area. The order of the questions is going to depend on the users preferences.
Clicking any of the questions is going to take you to another view that displays the answer. When viewing the answer the "settings"-button (blue area, top left) is changing to a "go back"-button.
Now as far as I've learned the blue area might be realized with a navigation controller, navigation bar.
The white section works pretty much like a toolbar. However I've read it's close to impossible to move the standard toolbar from the bottom to the top.
I've seen tutorials of people realizing this type of layout with (to me) complex code but without using the storyboard. Am I wasting time on figuring out how to manipulate storyboard objects? Coming from coding and programming websites the project looks so unbelievably simple. Is a project like this in fact rather complex to do as an app?
In any big project you will have to use all approaches, it is all about experience. For example, I am using StoryBoards to make 95% of my UIViewControllers elements, using XIB for static screens like error messages, some loadings etc. and using code to append some gradient views, shadows etc. It is possible that in future I will be doing all in a different way. But if you are a beginner - better use Storyboard, it makes getting into all of it much easier, understanding UIKit and iOS development overall.

Resize app automatically depending on screen size in swift

I just started making an app, and I have done a lot but I was not working with auto-layout. My whole app is in landscape mode, and I want it to work on all iPhone's. I now designed it for the iPhone 5, but when I open it on iPhone 6, there is a lot of whitespace. Is there a button to automatically resize everything? Or must I add auto layout and do every designing bit again?
Unfortunately you're probably going to have to layout everything again with auto-layout. A way to expedite your process would be converting the storyboard to auto-layout and then selecting "Reset to Suggested Constraints". You can access this option by pressing the small triangle icon in the bottom left.
Despite this, you probably will need to update a lot of the constraints manually. But this should give you a step in the right direction.
Have you tried Size Classes? Or Stack Views?
Size classes:
Apple documentation # https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Size-ClassSpecificLayout.html
Apple documentation on Stack Views #
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/LayoutUsingStackViews.html#//apple_ref/doc/uid/TP40010853-CH11-SW1
A good tutorial on "Stack Views":
https://www.raywenderlich.com/114552/uistackview-tutorial-introducing-stack-views

Having Issues Setting Up Constraints

I'm really having tough time setting my layout right for all iPhone sizes. I have five buttons and I want them to be visible correctly for all iPhone sizes, see the screenshot. I've tried many constraints but no success. Following are my questions.
What constraints do I need to add to these buttons to fit all iPhone screen sizes?
When I change "wAny hAny" to some other settings, all my UI controls vanish. What can be the possible reason?
Do I have to start in "Any Width | Any Height" configuration to design my app for all screen sizes?
3: it's a must: start of with Any x Any
2: other then Any x Any can have custom constraint settings (like bigger Font or const. for iPad). If things change when you switch to other then Any x Any then A: your constraints are messed up B: you have custom settings (which I doubt). Neither case I would recommend to start from Any x Any , remove all contraints, and start all over until Any x Any works! then move on to detailed customization.
1: use "greater or equal" relationship between the buttons horizontally. Add fix constraints if needed on the two sides.
Remove all warnings, read about it for two weeks :)