当viewcontroller被解雇时,补充视图仍然是短暂的

时间:2016-09-05 02:45:20

标签: ios swift uiviewcontroller nslayoutconstraint jsqmessagesviewcontroller

我在我的集​​合视图的顶部添加了一个视图,现在当我解除视图时,它仍然是一瞬间。有没有人知道可能导致这种情况的原因?

strsplit(x[1], "\\[\\d+\\],? \\.?")
# [[1]]
# [1] "163" "164" "165" "166" "167"

enter image description here

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:1)

如果您使用viewController解雇它,请尝试在newView .removeFromSuperview()中添加viewWillDissapear并在viewWillAppear中重新添​​加

答案 1 :(得分:0)

我只是错过了一个约束,愚蠢的我!

        let centerX = NSLayoutConstraint(item: newView, attribute: NSLayoutAttribute.CenterX, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.CenterX, multiplier: 1, constant: 0)
相关问题