I\'m currently transiting my application to iOS 7 (I want it to remain iOS 6 compatible). This question is not covered by the Apple NDA, it is a question about Auto Layout (
On iOS 7 you have the topLayoutGuide that specify the navigation bar. You can then specify that you want that the constraint of the tableview is on the topLayoutGuide and not the superview.
This will help you to know if it's iOS7 or not:
if ([self respondsToSelector:@selector(topLayoutGuide)])
So it can be something like that
NSString *verticalConstraint = @"V:|[v]|";
NSMutableDictionary *views = [NSMutableDictionary new];
views[@"v"] = self.tableview;
if ([self respondsToSelector:@selector(topLayoutGuide)]) {
views[@"topLayoutGuide"] = self.topLayoutGuide;
verticalConstraint = @"V:[topLayoutGuide][v]|";
}
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:verticalConstraint options:0 metrics:nil views:views]];
[self.view addConstraints:constraints];