1

Apple Mail app in thread views has a dynamic, taller than usual navigation bar which collapses when you scroll. Is it possible to achieve same effect using only allowed API calls or is this available only internally for Apple?

Expanded: Mail navigation bar expanded

Collapsed: Mail navigation bar collapsed

gklka
  • 2,459
  • 1
  • 26
  • 53

2 Answers2

0

Please check here. The link has different ways to solve the problem. However following code helped me.

for subview in (self.navigationController?.navigationBar.subviews)! {
   if NSStringFromClass(subview.classForCoder).contains("BarBackground") {
        var subViewFrame: CGRect = subview.frame
        // subViewFrame.origin.y = -20;
        subViewFrame.size.height = 100
        subview.frame = subViewFrame

    }

}
Pratik
  • 676
  • 10
  • 9
0

You can able to set it as follows

-(void)layoutSubviews{
        [super layoutSubviews];
        CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
        if (rectStatus.size.height==44.f) {

        }else{
            if (@available(iOS 11.0, *)) {
                for ( UIView*aView in self.subviews) {
                    if ([NSStringFromClass(aView.classForCoder) isEqualToString:@"_UINavigationBarContentView"]) {
                        aView.frame = CGRectMake( 0,20,aView.frame.size.width,44);
                    }
                    else if ([NSStringFromClass(aView.classForCoder) isEqualToString:@"_UIBarBackground"]) {
                        aView.frame = CGRectMake(0,0,aView.frame.size.width, 64);
                    }
                }
            }
        }
    }
casillas
  • 16,351
  • 19
  • 115
  • 215