Reputation: 141
I'm playing with iOS7
now, find that my view bounds became full screen
eg. before 320*460
now 320*480
with 20px
status bar over my view,
I know iOS7
starts to support full screen layout, and has a
self.edgesForExtendedLayout = UIRectEdgeNone;
to set, but this line seems work only when the navigation bar is shown.
I can't upload screenshots. In iOS6
view seems normal, and 320*460
,
in iOS7
it's 320*480
, status bar covers view contents.
If I use a navigation bar and set self.edgesForExtendedLayout = UIRectEdgeNone;
view frame became 320*416
, leaves 20
for status bar and 44
for nav bar, but my app is a custom top bar, not using navigation bar here.
If I change the frame of window, it moves down by 20 px
, but status bar seems clipped and a black 320*20
bar is shown,
Any method to make both iOS6
and iOS7
happy?
Upvotes: 2
Views: 1174
Reputation: 6766
From my observation you need to change the content inset of the tableview as you have the custom top bar which overlaps with the status bar. Please see the following code,
NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
if ( [[vComp objectAtIndex:0] intValue] >= 7)//do this only for ios7+ {
[self.tableview setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];
}
where tableview refers your tableview which go beyond the status bar. And I have hardcoded the top position to 64 (status bar height(20)+navigation bar height(44)). Please update it according to ur design.
setContentInset
is won't work with view. For view you need to updated the frame origin y position as like below,
if ( [[vComp objectAtIndex:0] intValue] >= 7)//do this only for ios7+ {
CGRect viewFrame = self.view.frame;
viewFrame.origin.y = 64;//change this according to ur top bar height.
self.view.frame = viewFrame;
}
Upvotes: 1