iphone - Auto Layout with navigation bar and view controller (iOS 7) -
i'm transiting application ios 7 (i want remain ios 6 compatible). question not covered apple nda, question auto layout (it seems ios 7 forces auto layout (edit : wrong, not forced)).
i have navigation controller root view controller (obvious). ios 6, not using auto layout, root view controllers below navigation bar. ios 7, frame origin not include navigation bar, top part of content hidden...
have idea how make entire view above navigation bar auto layout ?
thanks !
on ios 7 have toplayoutguide specify navigation bar. can specify want constraint of tableview on toplayoutguide , not superview.
this know if it's ios7 or not:
if ([self respondstoselector:@selector(toplayoutguide)])
so can 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];
Comments
Post a Comment