在UIView.h中,您可以阅读以下内容:
/* by default, the autoresizing mask on a view gives rise to constraints
that fully determine the view's position. Any constraints you set on
the view are likely to conflict with autoresizing constraints,
so you must turn off this property first. IB will turn it off for you.
*/
- (BOOL)translatesAutoresizingMaskIntoConstraints NS_AVAILABLE_IOS(6_0); // Default YES因此,这意味着当您从xib创建UIView时,translatesAutoresizingMaskIntoConstraints应该设置为NO。
但是,当我使用[[UINib nibWithNibName:nibName bundle:[NSBundle mainBundle]] instantiateWithOwner:self options:nil]创建一个xib视图时,translatesAutoresizingMaskIntoConstraints被设置为YES。
知道为什么吗?
发布于 2014-09-06 09:49:50
事实证明,这是苹果公司的bug报告中的一个bug。它应该在将来的版本中被修复。
https://stackoverflow.com/questions/23470857
复制相似问题