Je suis en train d'apprendre Swift avec le tutoriel Start Developing iOS Apps (Swift). Je crée ce contrôle personnalisé de notation, mais chaque fois que je lance l'application est envoie que vous avez choisi Erreur:XCode Swift: Pourquoi brise-t-il mes contraintes?
2017-08-09 15:49:41.894597+0200 FoodTracker[5051:2273797] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x17409af90 UIButton:0x100c12d90.width == 44 (active)>",
"<NSLayoutConstraint:0x17009c160 'UISV-canvas-connection' FoodTracker.RatingControl:0x100c02400.leading == UIButton:0x100c12d90.leading (active)>",
"<NSLayoutConstraint:0x17009c200 'UISV-canvas-connection' H:[UIButton:0x100c12d90]-(0)-| (active, names: '|':FoodTracker.RatingControl:0x100c02400)>",
"<NSLayoutConstraint:0x17009bee0 'UIView-Encapsulated-Layout-Width' FoodTracker.RatingControl:0x100c02400.width == 343 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17409af90 UIButton:0x100c12d90.width == 44 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-08-09 15:49:41.895770+0200 FoodTracker[5051:2273797] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x17409af40 UIButton:0x100c12d90.height == 44 (active)>",
"<NSLayoutConstraint:0x17009c250 'UISV-canvas-connection' FoodTracker.RatingControl:0x100c02400.top == UIButton:0x100c12d90.top (active)>",
"<NSLayoutConstraint:0x17009c340 'UISV-canvas-connection' V:[UIButton:0x100c12d90]-(0)-| (active, names: '|':FoodTracker.RatingControl:0x100c02400)>",
"<NSLayoutConstraint:0x17009bf30 'UIView-Encapsulated-Layout-Height' FoodTracker.RatingControl:0x100c02400.height == 50 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x17409af40 UIButton:0x100c12d90.height == 44 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Je mets les contraintes pour la largeur du bouton == 44 et pour la hauteur du bouton == 44, mais aucun de l'autre contraintes. J'ai tout fait comme décrit dans le tutoriel et je n'ai aucune idée de la raison pour laquelle cela ne fonctionne pas. J'ai vérifié toutes les contraintes que je peux trouver mais je ne suis pas sûr si c'était tout parce que je ne suis pas très expérimenté avec Xcode. Quelqu'un at-il une idée de la façon de résoudre le problème?
This is how it should look like: But this is how it looks: (Only The Red Area is important)
Thx pour votre aide!
Nico
est le carré/rectangle rouge un UIButton ou un UIView? – DonMag
UIButton à l'intérieur d'un StackView. –
ah - ok, je viens de jeter un oeil à travers le tutoriel que vous suivez .... Est-ce que le StackView lui-même est dans un StackView * vertical * qui contient les autres éléments? Si oui, est-ce que * Alignment de StackView est réglé sur Fill? – DonMag