Привет, я работаю над приложением, и в этом у меня есть UITableView с пользовательским дизайном ячейки. Когда я go к этому контроллеру представления, я вижу, что есть множество проблем, заявленных там в дизайне. Поэтому я подумал исправить их. Просто быстро перейду к проблеме, и вот то, на что я смотрел
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.
2020-02-21 11:35:00.835363+0500 HIRING App[490:51013] [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:0x2828bada0 UIButton:0x139cd30e0'Auto Add'.width == 100 (active)>",
"<NSLayoutConstraint:0x2828bbd40 H:|-(0)-[UIButton:0x139cd30e0'Auto Add'] (active, names: '|':UIStackView:0x139bc3d50 )>",
"<NSLayoutConstraint:0x2828bbd90 H:[UIButton:0x139cd30e0'Auto Add']-(4)-| (active, names: '|':UIStackView:0x139bc3d50 )>",
"<NSLayoutConstraint:0x282beb4d0 H:[UIStackView:0x139bc3d50]-(4)-| (active, names: '|':UIView:0x139bc8970 )>",
"<NSLayoutConstraint:0x282beb520 H:|-(4)-[UIStackView:0x139bc3d50] (active, names: '|':UIView:0x139bc8970 )>",
"<NSLayoutConstraint:0x2828a6620 UIView:0x139cd5ed0.width == 0.4*UIView:0x139bcf9f0.width (active)>",
"<NSLayoutConstraint:0x2828a6710 H:|-(0)-[UIView:0x139cd5ed0] (active, names: '|':UIView:0x139bcf9f0 )>",
"<NSLayoutConstraint:0x2828a6800 H:[UIView:0x139cd5ed0]-(1)-[UIView:0x139bc8970] (active)>",
"<NSLayoutConstraint:0x2828a75c0 H:[UIView:0x139bc8970]-(0)-| (active, names: '|':UIView:0x139bcf9f0 )>",
"<NSLayoutConstraint:0x2828aa3f0 UIView:0x139bcf9f0.width == 0.75*UIView:0x139cd2230.width (active)>",
"<NSLayoutConstraint:0x2828f2d50 H:|-(0)-[UIView:0x139cd2ab0] (active, names: '|':UIView:0x139cd7ec0 )>",
"<NSLayoutConstraint:0x2828fbd40 UIView:0x139cd2ab0.width == 0.32*UIView:0x139cd7ec0.width (active)>",
"<NSLayoutConstraint:0x282812ee0 H:[UIView:0x139cd2ab0]-(0)-[UIView:0x139cd2230] (active)>",
"<NSLayoutConstraint:0x282813890 H:[UIView:0x139cd2230]-(0)-| (active, names: '|':UIView:0x139cd7ec0 )>",
"<NSLayoutConstraint:0x282beb660 H:|-(0)-[UIView:0x139cd7ec0] (active, names: '|':UIView:0x139ccca70 )>",
"<NSLayoutConstraint:0x282beb750 UIView:0x139cd7ec0.trailing == UIButton:0x139cd4240.trailing (active)>",
"<NSLayoutConstraint:0x282beb7f0 H:[UIButton:0x139cd4240]-(4)-| (active, names: '|':UIView:0x139ccca70 )>",
"<NSLayoutConstraint:0x282beba20 H:|-(8)-[UIView:0x139ccca70] (active, names: '|':UITableViewCellContentView:0x139cf34c0 )>",
"<NSLayoutConstraint:0x282beba70 H:[UIView:0x139ccca70]-(8)-| (active, names: '|':UITableViewCellContentView:0x139cf34c0 )>",
"<NSLayoutConstraint:0x2828b9d60 'fittingSizeHTarget' UITableViewCellContentView:0x139cf34c0.width == 414 (active)>"
)
Это мой первый раз, когда я исправляю вид интерфейса. Я получил большую помощь по этой ТАМ. Но я действительно не понял, как он решил проблему. Я сделал то же самое, чтобы распечатать детали моей проблемы дизайна, так что я получил кое-что очень ясное, но все же я не понимаю, что решить первым. Пожалуйста, проведите меня или поделитесь чем-нибудь, что может помочь в определении проблем заранее спасибо. Ниже приведен след, который я получил, когда применил точку останова Symboli c, как предложено в ссылке SO.
UIWindow:0x137e36480
| UILayoutContainerView:0x137d41200
| | UITransitionView:0x137d41710
| | | UIViewControllerWrapperView:0x139baa680
| | | | UILayoutContainerView:0x137e36280
| | | | | UINavigationTransitionView:0x137e58cd0
| | | | | | UIViewControllerWrapperView:0x137d64520
| | | | | | | •UIView:0x137ee7d50
| | | | | | | | *<UILayoutGuide: 0x2832fad80 - "UIViewSafeAreaLayoutGuide", layoutFrame = {{0, 20}, {414, 667}}, owningView = <UIView: 0x137ee7d50; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x280b09ac0>>>
| | | | | | | | *UIView:0x137ee7f30
| | | | | | | | *UIView:0x137ee8110
| | | | | | | | | *UISegmentedControl:0x137ee59c0 alignmentRect = (65 16; 284 28) for frame = (65 16; 284 29);
| | | | | | | | | | UISegment:0x137ee5c30
| | | | | | | | | | | UISegmentLabel:0x137ee5ed0'AUTO ADD HISTORY'
| | | | | | | | | | | UIImageView:0x137ee6510
| | | | | | | | | | UISegment:0x137dbb4d0
| | | | | | | | | | | UISegmentLabel:0x137dbba00'AUTO ADD ON'
| | | | | | | | | | | UIImageView:0x137dbc320
| | | | | | | | | | UISegment:0x137ee6740
| | | | | | | | | | | UISegmentLabel:0x137ee69e0'ALL'
| | | | | | | | | | | UIImageView:0x137ee6cd0
| | | | | | | | | *UILabel:0x137ee7070'Swipe "Right" to send ite...'
| | | | | | | | | *UIView:0x137ee82f0
| | | | | | | | | | *UIView:0x137ee84d0
| | | | | | | | | | | *UIView:0x137ee86b0
| | | | | | | | | | | | *UIButton:0x137ee5060'Item/Purchase Dt'
| | | | | | | | | | | | | UIButtonLabel:0x137dc4110'Item/Purchase Dt'
| | | | | | | | | | | *UIView:0x137ee8890
| | | | | | | | | | | | *UIView:0x137ee8a70
| | | | | | | | | | | | | *UIButton:0x137ee56a0'QTY'
| | | | | | | | | | | | | | UIButtonLabel:0x137dc3e10'QTY'
| | | | | | | | | | | | *UIView:0x137dbcfd0
| | | | | | | | | | | | | *UIView:0x137dbd1b0
| | | | | | | | | | | | | | *UIButton:0x137ee5380'Expiry'
| | | | | | | | | | | | | | | UIButtonLabel:0x137dc3b10'Expiry'
| | | | | | | | | | | | | *UIView:0x137dbd390
| | | | | | | | | | | | | | *UIButton:0x137ee4940'Buy Again'
| | | | | | | | | | | | | | | UIButtonLabel:0x137dc2c00'Buy Again'
| | | | | | | | | *UITableView:0x1389a6800
| | | | | | | | | | HIRING_App.ItemPantryListCell:0x1389dda00
| | | | | | | | | | | •UITableViewCellContentView:0x139bc09b0, MISSING HOST CONSTRAINTS
| | | | | | | | | | | | *UIView:0x139bc0ba0
| | | | | | | | | | | | | *UIView:0x139bc0d80
| | | | | | | | | | | | | | *UIView:0x139bc0f60
| | | | | | | | | | | | | | | *UILabel:0x139bc1140'transaxle'
| | | | | | | | | | | | | | | *UILabel:0x139bc1430'02/21/2020'
| | | | | | | | | | | | | | *UIView:0x139bc1720
| | | | | | | | | | | | | | | *UIView:0x139bc1900
| | | | | | | | | | | | | | | | *UILabel:0x139bc1ae0'1 Item'
| | | | | | | | | | | | | | | *UIView:0x139bc1dd0
| | | | | | | | | | | | | | | | *UIView:0x139bc1fb0
| | | | | | | | | | | | | | | | | *UIStackView:0x139bc2190
| | | | | | | | | | | | | | | | | | *<_UILayoutSpacer: 0x2834f5860 - "UISV-alignment-spanner", layoutFrame = {{0, 0}, {75.333333333333329, 0}}, owningView = <UIStackView: 0x139bc2190; frame = (0 37.5; 75.5 32.5); opaque = NO; autoresize = RM+BM; layer = <CATransformLayer: 0x280a94dc0>>>- AMBIGUOUS LAYOUT for _UILayoutSpacer:0x2834f5860'UISV-alignment-spanner'.minY{id: 7931}, _UILayoutSpacer:0x2834f5860'UISV-alignment-spanner'.Height{id: 7932}
| | | | | | | | | | | | | | | | | | *UILabel:0x139bc2390'Label'- AMBIGUOUS LAYOUT for UILabel:0x139bc2390'Label'.minY{id: 7863}
| | | | | | | | | | | | | | | | | | *UIButton:0x139bc2680' Expiry Alert'
| | | | | | | | | | | | | | | | *UIView:0x139cc16c0
| | | | | | | | | | | | | | | | | *UIStackView:0x139cc2150
| | | | | | | | | | | | | | | | | | *<_UILayoutSpacer: 0x2834f11d0 - "UISV-alignment-spanner", layoutFrame = {{0, 0}, {104, 0}}, owningView = <UIStackView: 0x139cc2150; frame = (4 18.5; 104 70); opaque = NO; autoresize = RM+BM; layer = <CATransformLayer: 0x280a91460>>>- AMBIGUOUS LAYOUT for _UILayoutSpacer:0x2834f11d0'UISV-alignment-spanner'.minY{id: 7960}, _UILayoutSpacer:0x2834f11d0'UISV-alignment-spanner'.Height{id: 7961}
| | | | | | | | | | | | | | | | | | *UILabel:0x139cc2350- AMBIGUOUS LAYOUT for UILabel:0x139cc2350.minY{id: 7906}
| | | | | | | | | | | | | | | | | | *UIButton:0x139bc2c40'Auto Add'
| | | | | | | | | | | | | | | | | | | UIImageView:0x139bc37c0
| | | | | | | | | | | | | *UIButton:0x139cc3d80
| | | | | | | | | | | | | | UIImageView:0x139bc67f0
| | | | | | | | | | | | | *UIButton:0x139cc40a0
| | | | | | | | | | | | | | UIImageView:0x139bc6a20
| | | | | | | | | | | _UITableViewCellSeparatorView:0x139bc29a0
| | | | | | | | | | UIImageView:0x137ef5b00
| | | | | | | | | | UIImageView:0x137ef5d30
| | UITabBar:0x137d3eb00
| | | _UIBarBackground:0x137d402a0
| | | | UIImageView:0x137d40730
| | | | UIVisualEffectView:0x137d40960
| | | | | _UIVisualEffectBackdropView:0x137e17780
| | | | | _UIVisualEffectSubview:0x137e412b0
| | | UITabBarButton:0x137e4f830
| | | | UITabBarSwappableImageView:0x137d281a0
| | | | UITabBarButtonLabel:0x137e4fb50'MY LISTS'
| | | | _UIBadgeView:0x137d5e7f0
| | | | | UIImageView:0x137d60290
| | | | | UILabel:0x137d5f4b0'1'
| | | UITabBarButton:0x137d3f0d0
| | | | UITabBarSwappableImageView:0x137d3f900
| | | | UITabBarButtonLabel:0x137d3f5e0'CART'
| | | | _UIBadgeView:0x137d60ac0
| | | | | UIImageView:0x137d60cd0
| | | UITabBarButton:0x137e50380
| | | | UITabBarSwappableImageView:0x137e50bb0
| | | | UITabBarButtonLabel:0x137e50890'PANTRY'
| | | | _UIBadgeView:0x137d60f00
| | | | | UIImageView:0x137d61110
| | | | | UILabel:0x139cae990'1'
| | | UITabBarButton:0x137e50e00
| | | | UITabBarSwappableImageView:0x137e51630
| | | | UITabBarButtonLabel:0x137e51310'TODO'
| | | | _UIBadgeView:0x137d61340
| | | | | UIImageView:0x137d61550
| | | UITabBarButton:0x137e51880
| | | | UITabBarSwappableImageView:0x137e520b0
| | | | UITabBarButtonLabel:0x137e51d90'MORE'
Legend:
* - is laid out with auto layout
+ - is laid out manually, but is represented in the layout engine because translatesAutoresizingMaskIntoConstraints = YES
• - layout engine host