iOS 8 Xcode 6: What's the point of the grayed out constraints?

后端 未结 5 881
萌比男神i
萌比男神i 2020-12-17 09:14

In the Xcode 6 betas, when I delete a constraint, it doesn\'t remove it completely, but grays it out. I thought that was to imply that the constraint was used in a different

相关标签:
5条回答
  • 2020-12-17 09:46

    That's because of size classes, you can disable size classes from File Inspector and every greyed constraints runs out, you can re-enable them again if you need them.

    Hope it helps

    0 讨论(0)
  • 2020-12-17 09:49

    Double click the grayed out constraint (switches focus to the constraint) then press delete. This will delete the constraint.

    0 讨论(0)
  • 2020-12-17 09:54

    You can not delete grayed out constraints from the right hand Size Inspector (which is where I normally delete constraints because it's much easier to ascertain which view the constraints are for, it get's really confusing in the Document Outline), but you can delete the same grayed out constraints from the Document Outline on the left by selecting them and hitting the delete button.

    Example of grayed out constraint (see height):

    enter image description here

    Note: To make the Document Outline's constraints easier to digest, I first delete them from the Size Inspector, which grays them out, then delete the newly grayed out constraint from the Size Inspector. Just FYI.

    0 讨论(0)
  • 2020-12-17 09:58

    There are a few ways to delete the constraints from the Storyboard

    1. Try not to delete from the Storyboard object because sometimes different constraints can stack together and you might delete the wrong one. So, it is better to delete from the Document Outline. Just highlight the constraint that you want to delete on the Document Outline and just press delete button on your keyboard. See screen shot below: enter image description here

    2. If you want to clear all the constraints from a selected view, Select the View (eg: A button), Tap on the Third Button (Resolve Auto Layout Issues Button), Tap Clear Constraints. enter image description here

    3. If you want to clear all the constraints for all the views inside the view controller, Highlight the right view controller Object inside the storyboard, Tap on the Third Button (Resolve Auto Layout Issues Button), Tap Clear Constraints under the "All Views in the View Controller".

    0 讨论(0)
  • 2020-12-17 10:01

    I believe the answer to the following question is that you can have same constraint selectively "installed" (or to my understanding, enabled) for different size classes. After you select a constraint from Document Outline, you can click on the + sign to Add Size Class Customization from the bottom of Attribute Inspector. So when you delete a constraint from the Size Inspector, you're basically deleting a constraint for a particular size class only. In order to delete a constraint for all size classes, you have to delete from Document Outline.

    Why? Why can't you completely delete a constraint from the size inspector?!

    0 讨论(0)
提交回复
热议问题