Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am learning to program in XCode 7 and Swift 2. I built my app in Main.storyboard, but when I run it in the simulator it looks completely different.
Here are the photos so you can see what I am talking about.
Main.storyboard: http://shrani.si/f/3y/12M/34bm1y0G/1.jpg
Simulator: http://shrani.si/f/1t/ZZ/2AklkVvt/2.jpg
What do I need to do to make it appear the same as in the Main.storyboard?
Thank you for any help,
Aleks
You need to set Constraints.
The easiest way to do it is clicking the triangle and then "Add Missing Constraints" or "Reset to Suggested Constraints" (All Views in XYZ)
It takes a bunch of time to really understand how constraints and auto layout is working. And Xcode helped me a lot with the suggested constraints...
Here is a good tutorial for the start:
http://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I wrote a program and after re-running it on the simulator, it now shows the home screen in black.
You have tried to adapt your project not to use scene delegates, but you did it wrong. Here are the things you need to do:
Make sure the Info.plist has no Application Scene Manifest entry.
Make sure the AppDelegate has no methods that mention scenes.
Make sure the AppDelegate has a window property.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm trying to do something kinda of basic, but the Xcode has changed its constraint mechanism for size classes, apparently.
And so I want to know how to make this constraint actually apply for all size classes.
iPhone 7
iPhone SE
Please check out these images with constraints and set your lay out accordingly.
It appears I just used a bad previously programmed view controller, I have created a new one, added the subviews and constrains, and everything works fine now.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm making a simple iOS app in xcode using Swift and while I have the entire backend figured out (and it works perfectly), I don't understand constraints AT ALL. I'm trying to make my layout adaptive so it works on all iphone screens but I'm having a really difficult time. Any suggestions on how I can create the perfect layout? Resources would be helpful too. Most resources don't explain the concept or start from scratch.
Another issue I'm having is that every time I click on something, e.g. a table cell, and uncheck "Constrain to margins" and set the constraints, the changes aren't saved and as soon as I hit enter they revert back to the original settings.
REALLY lost on this whole constraints thing. Thanks!
So for learning constraints, I would advice you to do this tutorial. It is lengthy but it covers a lot of important concepts.
www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2
As for constraint to margins, you need to deselect "constraint to margins" before you edit the values. And once you edit a value, make sure the red lines are activated, and do not click on add constraints until you are sure of all the values. (1)
(Image 1)
You can check and edit the constraint in this window, just select your view and go here (2)
(image 2)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am using Xcode 7 and when I am using control drag to make an action with my UITextView to the ViewController.swift file, only the blue line shows up, but no line underneath the ViewController.swift file in which I can choose for an Outlet or Action.
These type of issues come into play when you try to connect the ViewController to a class that has a different class mentioned in the Identity Inspector of the storyboard. Make sure your view controller has the same class name mentioned in the storyboard to which you are trying to connect.
As shown in the image, make sure the class name is correct to which you are trying to connect.
Thank You!
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I put an image in the center but when I run it, it shows it on the right. I tried "Mode:Center" but still on the right. Does anybody know why?
You need to add constraints to your Image. You do that by leftclicking on the image in interface builder. After you selected the image you go to the bottom right corner of interface builder and click on the little triangle. Left click it, then left click "Add missing constraints"
Hope it helps