문제

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