Get status bar height from code

Use UIViewController Category

UIViewController+Layout.m

implementation UIViewController (Layout)

- (CGFloat)topContentOffset {
    if ([[self class] instancesRespondToSelector:@selector(topLayoutGuide)]) {
        return [self.topLayoutGuide length];
    }
    return 0;
}