jjzjj

widthAnchor

全部标签

iOS 自动布局 : why is zero multiplier not allowed?

我正在为动态创建的View的约束计算一些乘数。有时它为零。发生这种情况时,我会收到以下未处理的异常:Amultiplierof0oranilseconditemtogetherwithalocationforthefirstattributecreatesanillegalconstraintofalocationequaltoaconstant.Locationattributesmustbespecifiedinpairs来自这段代码:NSLayoutConstraint(item:spanView,attribute:.leading,relatedBy:.equal,toIte