In UIView.h you can read the following:

/* 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

So it means that when you create a UIView from a xib, translatesAutoresizingMaskIntoConstraints should be set to NO.

However, when I create a view form a xib using [[UINib nibWithNibName:nibName bundle:[NSBundle mainBundle]] instantiateWithOwner:self options:nil], translatesAutoresizingMaskIntoConstraints is set to YES.

Any idea why?

有帮助吗?

解决方案

It turns out to be a bug already filed in Apple's bug reporter. It should be fixed in a future release.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top