ステータスバーの対応
iOS7ではステータスバーの分、ビューが上にずれるという現象が起こる。
そのため、以下の処理を行うことでiOS7,iOS6以下でも対応することが可能
-(void) layoutSubviews {
[super layoutSubviews];
float width = self.bounds.size.width;
float height = self.bounds.size.height;
BOOL isOS7Later = [[UIDevice currentDevice].systemVersion floatValue] >= 7.0f
//注: 縦画面専用です
float sbarH = [UIApplication sharedApplication].statusBarFrame.size.height;
// iOS7でステータスバーに重ならないようにする
float navbarY = isOS7Later ? sbarH : 0;
self.navbar.frame = CGRectMake(0, navbarY, width, 44);
}
最終更新:2014年07月15日 00:33