я буду использовать следующие обозначения для объяснения invovled просмотров:IOS, "Невозможно одновременно удовлетворяют ограничения"
- {V} - The 'SuperView', то есть основного вид на корневом контроллере
- { Q} - прямоугольник в центре экрана, используемого в качестве викторины
- {W} - белая полоса выше {Q}
Я получаю следующий результат при работе на IPad-AIR2 тренажере:
2016-11-03 08:09:07.700117 MyApp[16645:6976134] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x60000009d600 h=--& v=--& QuizButtons:0x7fcb8e521830.width == 717 (active)>",
"<NSLayoutConstraint:0x608000281fe0 H:|-(0)-[ImgWhiteBar:0x7fcb8e525020] (active, names: '|':ViewTestVC:0x7fcb8e639b30)>",
"<NSLayoutConstraint:0x6080002820d0 H:[ImgWhiteBar:0x7fcb8e525020]-(0)-| (active, names: '|':ViewTestVC:0x7fcb8e639b30)>",
"<NSLayoutConstraint:0x608000282210 ImgWhiteBar:0x7fcb8e525020.width == 1.07143*QuizButtons:0x7fcb8e521830.width (active)>",
"<NSLayoutConstraint:0x60000009b9e0 'UIView-Encapsulated-Layout-Width' ViewTestVC:0x7fcb8e639b30.width == 768 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6080002820d0 H:[ImgWhiteBar:0x7fcb8e525020]-(0)-| (active, names: '|':ViewTestVC:0x7fcb8e639b30)>
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.
Моя интерпретация регистрируемых ограничений заключается в следующем:
- {Q}: по умолчанию
<h=--& v=--&>
, ширина = 717 - Horiz: {V.lead} -0- {W}
- Horiz : {W} {-0- V.trail}
- {W.width} = 1,07 * {Q.width}
- {V.width} = 768
Или, может быть немного проще
- {Q.width} должно быть 717
- {W.width} должен быть 768,21531
- {W} должны касаться обеих сторон {V}
- {V.width} = 768
Вопросы:
- Является ли моя интерпретация правильной?
- В чем проблема? Это из-за неточности 768.2 против 768? Если да, кто сказал Xcode использовать 717? Я сказал {Q.width}, чтобы быть {W.width}/[14:15]
Поблагодарите любую помощь здесь!
EDIT
Вот три из ограничений:
Опубликовать ограничения для ваших просмотров. –
Вы применяете несколько ограничений на «ImgWhiteBar». "H: | -ImgWhiteBar- |" И QuizButton и ImgWhiteBar с соотношением 15:14. Это создает 2 ограничения, и автозапуск не знает, как решить оба ограничения –
Спасибо @ManojAher за ответ. В моем случае whiteBar зависит от супервизора, а QuizButton зависит от whiteBar. По крайней мере, это то, что я пытался сделать. Разве это не нормально? – ishahak