I use autolayout in my view controller to align the uiview as if it were a navigation bar (aligned at the top, stretched to the back and front and 44 heights).
I have subclassed this view, and during awakeFromNib I want to add routines to it.
However, when I add these subviews (also with restrictions for the parent view), this does not work.
Initially, I thought that the restrictions were programmed incorrectly, however, after registering the presentation frame as follows:
- (void)awakeFromNib { [super awakeFromNib]; NSLog(@"%@", NSStringFromCGRect(self.frame)); }
I get the following output:
2012-11-27 03:25:25.976 myApp[8262:c07] {{0, 0}, {0, 0}}
However, when I log in, for example, touchesBegan:withEvent: it registers the correct frame size.
Does anyone know what could be causing this?
I also tried to set setTranslatesAutoresizingMaskIntoConstraints:NO for all the views in question. But nothing works.
Thanks in advance!
source share