gpt4 book ai didi

ios - 获取自动布局、自动布局、 Objective-C 的警告

转载 作者:可可西里 更新时间:2023-11-01 04:05:26 24 4
gpt4 key购买 nike

<分区>

我的目标:在 View 中将指示器(垂直和水平)居中放置在按钮上

我正在做的是:

[self.logInButton addConstraint:[NSLayoutConstraint constraintWithItem:spinner1
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.logInButton
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0]];
[self.logInButton addConstraint:[NSLayoutConstraint constraintWithItem:spinner1
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self.logInButton
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0]];
self.logInButton addSubView:spinner

但是,我在下面收到警告

The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x17e19390 UIActivityIndicatorView:0x17d035d0.centerY == UIButton:0x17df4430.centerY>
When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.
2013-06-12 17:37:19.610 FlipGive[366:60b] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x17e19810 UIActivityIndicatorView:0x17d035d0.centerX == UIButton:0x17df4430.centerX>
When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.

有谁知道我在这里做错了什么?请帮忙

欢迎所有评论。谢谢

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com