Change constraint target class - ios

I designed lots of constraints for my iOS app. Now the app works properly on all iPhone in portrait mode. I designed the constraints for the xCompact hRegular class. I realized, unfortunately only now, that all those constraints would be perfect also for all iPad in portrait. So, how can I change the constraints target class without recreating all of them for the more generic wAny hAny class? Thank you.

Select a constraint. In the last property in the attributes inspector, XCode shows you a list of check boxes with the size classes for which the constraint is active. The first check box represents wAny hAny, select it and repeat this for each constraint.

Related

How to fix missing constraint while restarting xcode 7.1

I have made two storyboards: one for iPhone and another for iPad. To create the iPad storyboard I have used size class wRegular hRegular. After fixing all my constraint issues, it works perfectly in preview, but when I restart Xcode some constraints are misplaced.
Screen shot misplaced constraint while restart xcode
Screen shot after updating the frame
just a suggestion , if you are using the same UI for both iPad and iPhone , better to use a single storyboard for both .
The Basic concept of using Size class is whatever your Base design.it
should be designed in wAny hAny.
Now it you want any perticular view should be displayed in perticular
size class then only it can be added to that size class eg. if you
want label should be displayed in iPad then you should add it
wRegular hRegular Size class.As label added to wRegular hRegular it will only visible for iPad 7 not visible in iPhones.
So what you need to do is Redesign your StoryBoard in wAny hAny and
add constraints to it.
You can Also refer my answer which has some description Main.Storyboard Frames Not Updated

Constraints collision between size classes

I want to create constraints which simply create a vertical space between two views.
First I create it in the wAny hAny size class with a space of 40.
Then I want to have the same constraint with other values in other size classes.
But when I create the same constraint, just with another value Xcode gives me an
auto-layout error that those constraints are colliding.
Because wAny hAny is valid in all other size-classes as well.
In a first attempt I have deleted the constraint out of the wAny hAny size class but then I get the
auto-layout error that the layout is not defined correctly in wAny hAny.
So, it does not matter how I create it, there is always an auto-layout error. I think I just missed a basic concept here to understand what is going wrong. Can somebody explain it to me?
Thanks.
I have found the problem. I was doing it wrong. What I have done is - changing the size-class by selecting the size-class in IB (clicking on wAny hAny at the bottom of the IB screen) and then just set another constant value. This does not work.
This is how it works. Go to the size inspector and click on the plus sign on the left of the constant. Now add the size class. This creates a second constant for the new size class.
Now setting the value on the second constant does work. The original hAny wAny size class is not affected.

iOS8: class size w:Regular h:Compact To w:Any h:Any

I've made my storyboard support only w:Regular h:Compact.
Cause i needed to support all devices in landscape.
But I've figure that it's not supporting iPad that way.
When i run iPad it just a blank page.
I tried to convert it to any:any but it hide all the sub views.
Is there anyway to convert this class size to any:any to support all without risking redo all this work?
Or at least I need a way to make it only for iPad?
First of all, wRegular hCompact is for iPhone 6 Plus in landscape, not iPads in landscape:
Be sure to check the description at the bottom of the size class choice.
If you want to convert existing elements to show in wAny hAny, try choosing each element, then going to the attributes inspector and clicking the + button at the bottom, then add it for any width and any height. Make sure the checkmark is there beside installed for any width and any height also.

Size Classes Troubles

So I've been using size classes in Xcode 6 beta. I started out by putting some buttons in the middle of the screen in the AnyxAny base class. They showed up on the right side of the screen when I then ran the app in the iPhone simulator. To fix this, I went into the compactxregular size class and dragged the buttons to the middle and spaced them out a little. Then, when I ran it in the simulator, nothing had changed. Why? Is it just a glitch in the beta version or am I not doing something right? It worked when I added a center x alignment constraint to the buttons but I still wanted to do some spacing. (and also, what's the point of the size classes if I could just do it using constraints?)
The size classes are important so you can add individual constraints per size class (using the same storyboard). It has the flexibility to allow you to share certain constraints between all sizes devices and orientations, or just a single.
Click on each constraint you add and on the right menu, you can toggle which size class you'd like to add the constraint for. (It's the + button next to the installed check marks)
You can specify different constraints for different size classes. Watch the WWDDC 2014 video View Controller Advancements in iOS 8 to see how to do it in IB. If you can specify the layout you need without size classes, don’t bother; they’re just for overrides.

Xcode6 Interface Builder has "hidden" my views?

I am not sure how this happened but the view hierarchy on my Xcode6 project have 'hidden' themselves.
On the menu on the left the views have a weird icon and on the layout view and on the app itself the views do not appear.
On the right side all the constraints are greyed out.
Is this a feature or a bug? i can't really find anything i can click to get them to show again. Did i accidentally hit a shortcut?
I think you have changed the size class in the Xcode. May be you have designed it in one size class(not in wAny hAny)and accidentally changed to another. Only the layout designed in wAny hAny will be available for all devices/orientations. If you chosen any specific size class, your view's and constraint's will be hidden for other layouts(grey out). To get it back change size class at the bottom of the IB to yours(i don't know which one you have chosen initially). I would suggest you to design your layout in wAny hAny and do any specific layout changes for a device/orientation using other size classes.
change it here wAny hAny (Interface builder bottom)

Resources