Простое заполнение панели инструментов вызывает конфликт автоматической компоновкиIOS

Программируем под IOS
Ответить
Anonymous
 Простое заполнение панели инструментов вызывает конфликт автоматической компоновки

Сообщение Anonymous »

В iOS 26 заполнение панели инструментов моего контроллера представления (встроенного в контроллер навигации, который показывает панель инструментов) самым простым способом вызывает конфликты авторазметки:

Код: Выделить всё

let newGame = UIBarButtonItem(title: "New Game", image: nil, target: self, action: #selector(doNew))
let flex = UIBarButtonItem.flexibleSpace()
let help = UIBarButtonItem(title: nil, image: UIImage(systemName: "questionmark.circle"), target: self, action: #selector(doHelp))
setToolbarItems([newGame, flex, help], animated: true)
Вывод:

Код: Выделить всё

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)
(
"",
"",
"",
"",
"",
""
)

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  may also be helpful.
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)
(
"",
"",
"",
"",
"",
""
)

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  may also be helpful.
Я сообщил об этом как об ошибке в Apple, но мне хотелось бы обойти ее (т. е. предотвратить вывод предупреждения о конфликте в консоль), и мне интересно, нашел ли кто-нибудь обходной путь.


Подробнее здесь: https://stackoverflow.com/questions/797 ... t-conflict
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»