Adjusting for transparent navigation bar


I’m having to add something like this to my view controller:

- (void) viewDidLayoutSubviews { NSLog(@"Inside viewDidLayoutSubviews: %f", [self.topLayoutGuide length]); if (!self.adjustedFortopLayout) { CGFloat topLayoutGuideLength = [self.topLayoutGuide length]; self.patientNameTopConstraint.constant += topLayoutGuideLength; [self.view layoutSubviews]; self.adjustedFortopLayout = YES; } }

I was just wondering if this was the “accepted” way to constrain a subview to the top if the navigation bar was translucent, which seems to be more prominent in iOS 7 since translucency is the default. I noticed if I set my navigation bar to opaque then the constraint was automatically against the bottom of the navigation bar.