Skip to content

Collapsable Header View: Constraint warning when rotating to landscape #18749

Description

@twstokes

Expected behavior

No conflicting constraints.

Actual behavior

Constraints are conflicted and an error is shown in the target output:

2022-05-26 13:31:15.095161-0400 WordPress[98955:1090397] [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:0x12fba1880 V:|-(10)-[UIStackView:0x1181e3690]   (active, names: '|':WordPress.CollapsableHeaderView:0x1181f51a0 )>",
    "<NSLayoutConstraint:0x1393d63d0 V:[UIStackView:0x1181e3690]-(12)-[UILabel:0x1181384b0]   (active)>",
    "<NSLayoutConstraint:0x1393ee9b0 V:[UILabel:0x1181384b0]-(20)-[UIView:0x1181f44b0]   (active)>",
    "<NSLayoutConstraint:0x12fbd9e10 V:|-(0)-[UIView:0x1181f44b0]   (active, names: '|':WordPress.CollapsableHeaderView:0x1181f51a0 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x1393ee9b0 V:[UILabel:0x1181384b0]-(20)-[UIView:0x1181f44b0]   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

Steps to reproduce the behavior

  1. Build WPiOS using Xcode and run in Simulator or on a physical device in portrait orientation
  2. Access a view that uses a CollapsableHeaderViewController:
  • My Site -> Tap FAB (blue circle) -> Site page -> Choose a Layout
  • My Site -> Create WordPress.com site -> What's your website about?
  1. Rotate to landscape and observe the target output
Tested on iPhone 13, iOS 15.5, WPiOS 19.9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions