#ios #nslayoutconstraint
#iOS #nslayoutconstraint
Вопрос:
Я получаю следующий журнал в своей консоли в XCode.
2016-10-12 16:48:13.218 xx[319:19209] 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:0x16c610c0 H:[JTImageButton:0x16c61120'Ufffc(null)'(130)]>",
"<NSLayoutConstraint:0x16be02a0 '_UITemporaryLayoutWidth' H:[JTImageButton:0x16c61120'Ufffc(null)'(1000)]>"
)
Will attempt to recover by breaking constraint
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.
И мой экран мерцает, когда происходит этот журнал.
Как я могу это решить?
Ответ №1:
Вы указываете свой JTImageButton
горизонтальный размер 130, и после этого вы определяете другое ограничение, которое устанавливает горизонтальный размер 1000. Удалите 1 из этих ограничений. Вы не можете определить несколько ограничений размера для одной и той же оси.
Комментарии:
1. Я не добавляю 1000. Это то, чего я не знаю. _UITemporaryLayoutWidth был добавлен, и я не знаю, где.