Xamarin.iOS:以编程方式更改高度锚点

时间:2016-07-30 15:08:41

标签: c# ios xamarin.ios

我在UIStackView的高度,在故事板中设置为100。我以编程方式将循环中的SubViews添加到StackView中。所以,我需要以编程方式更改StackView的高度

所以我试过了,

summaryStackView.HeightAnchor.ConstraintEqualTo(summaryStackView.HeightAnchor).Active = false;
summaryStackView.HeightAnchor.ConstraintEqualTo(HEIGHT).Active = 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. 
(
    "<NSLayoutConstraint:0x7d538010 V:[UIStackView:0x7d538460(200)]>",
    "<NSLayoutConstraint:0x7d48f4a0 V:[UIStackView:0x7d538460(184)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7d538010 V:[UIStackView:0x7d538460(200)]>

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.
Thread finished: <Thread Pool> #9
Thread finished: <Thread Pool> #7
Thread finished: <Thread Pool> #8
2016-07-30 20:29:20.119 Gogch.iOS[2219:175673] 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:0x7d60e9a0 H:[UIView:0x7d60eb50(320)]>",
    "<NSLayoutConstraint:0x7d2cffd0 'fittingSizeHTarget' H:[UIView:0x7d60eb50(359)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7d2cffd0 'fittingSizeHTarget' H:[UIView:0x7d60eb50(359)]>

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.
2016-07-30 20:29:20.124 Gogch.iOS[2219:175673] 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:0x7d60e9a0 H:[UIView:0x7d60eb50(320)]>",
    "<NSLayoutConstraint:0x7d4694c0 'fittingSizeHTarget' H:[UIView:0x7d60eb50(359)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7d4694c0 'fittingSizeHTarget' H:[UIView:0x7d60eb50(359)]>

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.

如何正确更改?

0 个答案:

没有答案