TranslatesAutoresizingMaskIntoConstraints and IB

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

This means that when creating UIViewfrom xib, translatesAutoresizingMaskIntoConstraintsa value must be set NO.

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

Any idea why?

+4
source share
1 answer

It turns out that the error has already been filed in an Apple reporter. It should be fixed in a future release.

+1
source

Source: https://habr.com/ru/post/1539265/


All Articles