Xcode simulates App wrong - ios

I don't know what I've done. Everything was working great until I started styling my app. So, I was working on my main storyboard and when I tried to simulate my App in the simulator. I saw my Icons flying around like crazy.
I am more familiar with coding so I'm sorry if this is a nooby question but I don't know how to describe my problem to Google, I really tried it but it turns out to be other problems.
I will hang on screenshots, one is from my storyboard and the other one is whats the simulator shows me.
View in main storyboard:
View in simulator:

From your description and images, it looks like you're using auto layout but haven't applied enough constraints to locate the images where you want them, or the constraints are just wrong. Take a close look at your storyboard to make sure that you don't have any warnings about missing constraints, and that the constraints do what you want them to do.

Related

How to get iOS app to work on all iPhones? (Constraints)

I am fairly new to developing for iOS. I have a fully functioning program written in Swift and the UI was created in the scene builder on Xcode. I created an app for my work to simplify closing out the registers and other financial aspects. The app is complete and works perfectly, but was designed on the iPhoneX. The problem is that only a few of the employees have an iPhoneX, but they all have some kind of iPhone. I have tried setting up constraints but it never works. Ive tried scaling restraints and position restraints but I can't get the layout to look right on any other phone, and when I add the constraints it affects the view on the iPhoneX as well and doesn't look good on any iPhone. I need help getting this to work on all iPhones. I would like it to look and act the exact same regardless of the size of the phone, basically just scaled down. There are a lot of things on the screen and I can't figure out how to do this. Please help!!!
I have been working on this for a long time and I really need help. Please let me know if I need to clarify anything. I have posted links to some pictures of my UI so you have an idea of whats going on.
Constraints I tried adding, although I have played around with some other options.
Here's what it looks like on the iPhoneX, this is how I want it to look.
What it looks like on iPhoneSE (with constraints).
One thing I noticed in your Xcode project that none of your features are in UIView. Without it, it will be quite challenging and somewhat always different results. In theory, if you use AutoLayout features correctly it should work without UIView, but they make life so much easier. This is something I learned the hard way at the beginning of my iOS development. First set up your UIViews without any content inside it, give them some background colour to differentiate, once they are working on all devices. You can pin your features to superviews with no difficulty.
Since you have a repetitive features, you could also consider using Stack Views. You don't have complicated features, so as long as AutoLayout is set up correctly you should have no problems seeing it ok on all devices

UINavigationBAr Title as an Image, used to work, doesn't display anymore in XCode9

I'm having a small annoying issue, I'm using storyboards on this app since it's creation, I want to make an update to it and something that used to work before doesn't anymore
See I was using an image as a UINavigationBar Title, Dragged it to the storyboard and it worked almost automatically,
Now well the image doesn't display anymore... Here's a screen :
As you Can see, the UIImageView is there, but nothing shows up. and when I run the app, still nothing...
I'd like to solve it trought Storyboards, but my knowledge is limited
thanks

Having issues with auto layout showing up different than preview

I'm trying to follow the tutorial on Apples Swift Tutorial
I've followed the UI layout but for some reason, when I hit play and the simulator pops up, my simulator shows up different than my preview. Any suggestions?
I feel this question may help somebody in the future so I won't bother deleting it.
Through my own stupidity I ended up building the UI under the LaunchScreen.storyboard ViewController instead of the Main.storyboard ViewController. Simple fix -> Put things where it belongs!

Simple IOS Layout

I have been trying to do this layout for a few days now and cannot do it. I have no code as I have been only using Storyboard.
In my Android version I simply used a weighted LinearLayout where my title was 20% my relative layout was 60% and my custom object was 20%.
I cannot replicate this in IOS. Everything I try fails. I have tried everything and have tried using StackViews, EqualHeight constraints with multipliers and everything does not work. Most of the time nothing even happens and it just looks the same. Can someone please help me? I am so frustrated I am considering abandoning XCode in total and coding my app in React Native.
It's not really clear what you're asking. But if you want to use storyboards, it's pretty easy with XCode. You can set your layout visually, then simply use the "auto-resolve" feature (little triangle inside of bars on bottom right above the console) to: 1) "clear constraints" and then 2) "reset to suggested constraints". This is a fast and crude method that should more than enough to get started.

Xcode 6: label won't drag

Im just picking up ios development, and Im having a stupidly basic problem with xcode...
I open up a new app and open main.storyboard, and drag in a label to the center of the panel:
It just sticks to the right side, and no matter how many times I click on the darned thing, it won't move! I closed the project and started a new one, and that one worked just fine, but the problem keeps appearing just about every other time I open a new project. why does this keep happening?
That is a strange problem. You say that if you close the project and start it again, it fixes itself but keeps reappearing.
Few suggestions, try clearing up some ram by closing other, unused apps.
If that does not work, I would say delete Xcode, restart your mac, and start over. Maybe something went wrong during the install.
Storyboards are scrollable and when you scrolled out your views, you cannot make any changes to the views. Try scrolling into the storyboard and then retry moving the label.
It's AutoLayout, which is the highly recommended default for laying out components now. You need to create constraints to
position it, using the icons below the layout area.
Some components I've found I need to manipulate via the size inspector, before constraints are applied.
You will need to read up on Auto Layout sooner or later. It may seem like a hassle or drag at first, and a lot of people are cursing when they have to switch to the paradigm, but when you start to master it, it is very powerful. And it really is a sensible way to handle the layout across all the new screen sizes and orientations. It developed out of a need to manage that complexity to keep apps looking good.
Icons in IB where you set constraints for selected views:
Apple has good documentation for how to use Auto Layout as do many bloggers and sites. You will have to put some hours into getting used to it, but in a day or two you should start seeing good results.
(and don't blame me, I'm just the messenger)

Resources