Does anyone know why I get the following message:
"The selected views have no constraints. At build time explicit left, top, width, and height constraints will be generated for the view."
I'm using XCode 5 - Storyboard with AutoLayout turned on
Found the solution!
Select the ViewController then from the XCode menu:
Editor --> Resolve Auto Layout issues --> Add missing constraints in View Controller
It appears that in Xcode 5.1 when using AutoLayout, when you create a new scene it will start without any editable constraints. They are generated at runtime to reflect the scene's intended layout.
So adding constraints in interface builder is not needed only if you wish to modify the defaults. When you do that you need to familiarize yourself with the provided tools (as seen in the "Resolve auto layout Issues" menu)
In a ideal wold layout just works without thinking to constraints, even if they work behind the scenes. It seems to me a step towards that goal. This is not to start a debate if the goal can be reached, only to say that we can expect more similar interface builder / xcode changes to follow.
You have selected auto layout on your viewcontroller , so you can't set the contraints manually , uncheck the layout , it will show the constraints automatically .
Related
I want to layout my labels like this using auto layout. It works fine in iPad 10.5. But when I move to any other versions of iPad with a larger screen, this design brokes. Anyone, please help me to solve this problem.
Swift 4
Use stack view
Step 1. insert labels inside of stack view
like that
Step 2. add constraints on stack view
from top, bottom, left and right alignment according to your requirement
like that ->
Step 3.
Use Stackview properties
a.) set axis of Stack view Horizontally as well as vertically.
b.) set alignment according to requirements.
c.) set Distribution according to requirements (here i used fill equally).
b.) set Spacing between labels .
See here ->
Now run. it will work, it will show same in all Device like iPhone and iPad and also (horizontal and vertical).
it will show like this(iPhone6splus)
Thank you
It seems like you create/checked constrations only for iPad or iPhone. Change a type of device scoping on Storyboard editor and you can find errors. Take care about UI for all of device types.
You can add constraints by "Add missing Constraints".
1.select your labels
2.And click the "Add missing Constraints"
i have a problem. I had a storyboard in Xcode 6 with the inferred size of the view controller and the "Use Auto layout" option checked. Today i wanted to use the new " Use Size Classes" option. I checked the option and then in the simulator the screen was all black!
EDIT
now that i resolved this issue i have another thing here ! I use "Add missing costraints" option to have a resize for all Apple Device, the Tab bar and navigation bar are good, but then all the buttons ( they have an image ) are in different position !
How i can resolve that ? Thanks in advance.
A black view.. if not always, is a good indicative that the view is not loaded. Size Classes introduces a new concept ...You can have several views that will be installed or not into your view depending of your view configuration. More details on images below:
This is what you will be looking for:
This is what I call view rendering configuration (sure Apple has another name for it). It is located at center bottom of your storyboard view.
This is always located at the end of Attributes Inspector tab:
Make sure it is enabled for the view that suits your testing device.
I found out that the ViewController wasn't set as Initial Controller.
You should avoid as possible the use of "add missing constrains". Is an automatic tool that almost always ends up adding unnecessary constrains or breaking others.
If you want something to look really good an stable, sadly there are no shortcuts... you will eventually end having to do it all by yourself.
I am working with iOS6 and Xcode 4.5, I am getting an UI issue with some UIButton, some of the buttons title are not getting shown in my view.
In an older version of iOS everything works as expected.
Please see the following image. It's not showing the text "Button" while executing it on simulator
I had a similar case which I just resolved. I think I know what triggers the issue with auto-layout.
I assume that you have created one button, then copied across the row and then copied the rows down. When you do that, one of the auto-layout constraints that's set is "Baseline alignment" between the buttons.
The problem is if this constraints (it does not have to be user-level) remains between buttons which are not on the same horizontal position, meaning between buttons in different rows. So select the problematic button and check to see if you have this constraint. This was my case:
If you do, select it, upgrade to user-defined and delete it. All magically works afterwards.
1Finally i solved my issue , actually iOS6 makes a default auto layout for view controller , through that it will align each component in the view .while i dont need the auto layout .
so i just uncheck the auto layout in property which solved my issue .
clean your project and build again, if not work then restart the xcode and remove the old app from the simulator.
one thing more, if nothing work for you then remove the button and add new buttons.
Try changing the "line break" property of the button to anything other than truncate middle. It looks like it's being truncated to just an ellipsis.
I'm trying to layout a very simple view. I've placed 4 custom buttons in the view in a grid like spacing. But when I run the app I get two of the buttons with different sizes. I've included the storyboard and simulator images here.
I would LOVE to disable constraints but cant find where to do it! I really don't want them. This is just for a simple prototype app and in the end I won't even have these buttons, I'll lay everything out in code.
I've tried dragging in 4 individual buttons AND tried just dragging in one and duplicating it to where I want. I just want them to stay where I put them! Any help would be appreciated.
-Mark
You turn it off in the File Inspector (first tab on left) -- there's a checkbox called "Use Autolayout" (it's checked by default).
I want to change the spring & struts setting in the storyboard (xcode 4.3.3)
Currently, in the size inspector (auto sizing), two struts are active (outer markers) - the top and the left makers, with zero springs (inner makers) are active.
I would like to activate both the inner markers, but xcode currently does not allow me to click them.
If I create a new ViewController and UIView, I can change the auto sizing for the new one.
But ideally, I would like to know how to be able to fix this issue, without creating a new storyboard from scratch.
Does anyone know what is causing this?
Thanks,