利用自动适配时,视图没有父视图时报错

Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors and because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.'

当A视图添加在父视图上,B视图未添加在父视图上时,而A视图引用了B视图,找不到B视图的父视图,也就是说没有一个固定的锚点,没有一个相对约束,从而报错

你可能感兴趣的:(利用自动适配时,视图没有父视图时报错)