質問

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