Status bar overlapping when using ECSlidingViewController

malkoty

I added the following code in the AppDelegate implementor function didFinishLaunchingWithOptions

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {

    [application setStatusBarStyle:UIStatusBarStyleLightContent];

    self.window.clipsToBounds =YES;

   self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(applicationDidChangeStatusBarOrientation:)
                                                 name:UIApplicationDidChangeStatusBarOrientationNotification
                                               object:nil];

}

as well as this function that is being called:

- (void)applicationDidChangeStatusBarOrientation:(NSNotification *)notification
{
    int a = [[notification.userInfo objectForKey: UIApplicationStatusBarOrientationUserInfoKey] intValue];
   int w = [[UIScreen mainScreen] bounds].size.width;
    int h = [[UIScreen mainScreen] bounds].size.height;

    UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
    UIDeviceOrientation orientationa = [[UIDevice currentDevice] orientation];

   if (orientation==4)
    {
        self.window.frame =  CGRectMake(20,0,w-20,h+20);
    }else if(orientation==1)
    {
        self.window.frame =  CGRectMake(0,20,w,h);
    }else
    {
       self.window.frame =  CGRectMake(-20,0,w+20,h+20);
    }
}

This works with getting the status bar to not overlap even when rotating but when clicking on a button that makes a request to the backend it changes and overlaps until it is rotated again, anyone knows why this might happen? I suspect it could be something to do with the ECSlidingViewController?

Gurpreet

Try this code & set this in Info.plist View controller-based status bar appearance = NO

- (void) viewDidLoad
{
    [super viewDidLoad];

    float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];

    if (systemVersion >= 7.0f)
    {
        CGRect tempRect;

        for (UIView *sub in [[self view] subviews])
        {
            tempRect = [sub frame];

            tempRect.origin.y += 20.0f; //Height of status bar

            [sub setFrame:tempRect];
        }
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Navigation bar overlapping status bar

From Dev

How to know when menu is "open" using ECSlidingViewController

From Java

Toolbar overlapping below status bar

From Dev

ios UITableViewController overlapping status bar

From Dev

iOS status bar overlapping contents

From Dev

Search bar overlapping status bar in search controller

From Dev

iOS 7 status bar overlapping UI

From Dev

status bar is overlapping with the view in iOS7

From Dev

Status bar not transparent when using new support design library

From Dev

When using ActionMode, the status bar turns black on Lollipop

From Dev

Android Status Bar transparent when using AppTheme.NoActionBar

From Dev

Hide status bar when using a YoutubeFragment (YoutubePlayer android API)

From Dev

Removing Status Bar In IOS 8 When Using A UINavigationController

From Dev

Overlapping bars when trying to fix bar width using facet_wrap from ggplot2

From Dev

position:fixed navigation header overlapping browser scroll bar when using overflow-x

From Dev

jQuery Mobile with Cordova - Header overlapping with iOS Status Bar

From Dev

How to stop an uitableview housed in tabbarcontrol from overlapping the status bar?

From Java

How to prevent layout from overlapping with iOS status bar

From Dev

How to prevent status bar from overlapping content with hidesBarsOnSwipe set on UINavigationController?

From Dev

iOS 7 status bar overlapping UI - Need solution for Cordova 3.0

From Dev

iOS 8 Webapp Status Bar overlapping webapp header in homescreen mode

From Dev

Ionic 5 ion-searchbar in header overlapping with status bar in ios

From Dev

Why my views are overlapping status bar in Android Studio Layout Editor

From Dev

Show status bar when hide navigation bar

From Dev

Android status bar scrolling up with coordinator layout, leaving status icons overlapping toolbar title

From Dev

Status Bar turning completely black when using clipsToBounds = YES in iOS8. How do I change this?

From Dev

Odoo status bar glitches when I reload the page using browser refresh page (F5)

From Dev

Strange Status Bar Behavior when Invoking a Shell Command Using Excel VBA

From Dev

How to hide the text displayed on status bar when I make an ajax call using Javascript

Related Related

  1. 1

    Navigation bar overlapping status bar

  2. 2

    How to know when menu is "open" using ECSlidingViewController

  3. 3

    Toolbar overlapping below status bar

  4. 4

    ios UITableViewController overlapping status bar

  5. 5

    iOS status bar overlapping contents

  6. 6

    Search bar overlapping status bar in search controller

  7. 7

    iOS 7 status bar overlapping UI

  8. 8

    status bar is overlapping with the view in iOS7

  9. 9

    Status bar not transparent when using new support design library

  10. 10

    When using ActionMode, the status bar turns black on Lollipop

  11. 11

    Android Status Bar transparent when using AppTheme.NoActionBar

  12. 12

    Hide status bar when using a YoutubeFragment (YoutubePlayer android API)

  13. 13

    Removing Status Bar In IOS 8 When Using A UINavigationController

  14. 14

    Overlapping bars when trying to fix bar width using facet_wrap from ggplot2

  15. 15

    position:fixed navigation header overlapping browser scroll bar when using overflow-x

  16. 16

    jQuery Mobile with Cordova - Header overlapping with iOS Status Bar

  17. 17

    How to stop an uitableview housed in tabbarcontrol from overlapping the status bar?

  18. 18

    How to prevent layout from overlapping with iOS status bar

  19. 19

    How to prevent status bar from overlapping content with hidesBarsOnSwipe set on UINavigationController?

  20. 20

    iOS 7 status bar overlapping UI - Need solution for Cordova 3.0

  21. 21

    iOS 8 Webapp Status Bar overlapping webapp header in homescreen mode

  22. 22

    Ionic 5 ion-searchbar in header overlapping with status bar in ios

  23. 23

    Why my views are overlapping status bar in Android Studio Layout Editor

  24. 24

    Show status bar when hide navigation bar

  25. 25

    Android status bar scrolling up with coordinator layout, leaving status icons overlapping toolbar title

  26. 26

    Status Bar turning completely black when using clipsToBounds = YES in iOS8. How do I change this?

  27. 27

    Odoo status bar glitches when I reload the page using browser refresh page (F5)

  28. 28

    Strange Status Bar Behavior when Invoking a Shell Command Using Excel VBA

  29. 29

    How to hide the text displayed on status bar when I make an ajax call using Javascript

HotTag

Archive