Das einfache Auffüllen der Symbolleiste führt zu Konflikten beim automatischen LayoutIOS

Programmierung für iOS
Anonymous
 Das einfache Auffüllen der Symbolleiste führt zu Konflikten beim automatischen Layout

Post by Anonymous »

In iOS 26 führt das Auffüllen der Symbolleiste meines Ansichts-Controllers (eingebettet in einen Navigations-Controller, der seine Symbolleiste anzeigt) auf einfachste Weise zu Autolayout-Konflikten:

Code: Select all

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)
Ausgabe:

Code: Select all

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.
Ich habe dies als Fehler an Apple gemeldet, würde ihn aber gerne umgehen (d. h. verhindern, dass die Konfliktwarnung in die Konsole ausgegeben wird) und frage mich, ob jemand eine Problemumgehung gefunden hat.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post