0

Here is the scenario.

Before launching my app, I make a phone call. Then I open my app, the status bar height has doubled due to call notification. and because of that, the entire UI of my app has been pushed down by additional 20pt. Switching back to phone app and end the call, when I open my app again, the UI gets stuck as just now, except that the green notification bar's gone, leaving an additional 20pt black bar on top.

This does not happen if my app is already launched before I make the call.

I've used [self.window makeKeyAndVisible];

Any idea how to adjust UI properly in this case?

Update:

Here's the code

    ADTransitionController *transitionController= [[ADTransitionController alloc] initWithRootViewController:[[MainViewController alloc] init]];
    transitionController.wantsFullScreenLayout = YES;

    ConfigurationSetupViewController *menuController = [[ConfigurationSetupViewController alloc] init];

    REFrostedViewController *frostedViewController = [[REFrostedViewController alloc] initWithContentViewController:transitionController menuViewController:menuController];
    frostedViewController.direction = REFrostedViewControllerDirectionLeft;
    frostedViewController.liveBlurBackgroundStyle = REFrostedViewControllerLiveBackgroundStyleLight;
    if ([GBDeviceInfo deviceDetails].majoriOSVersion < 7) {
        frostedViewController.blurRadius = 2;
    }
    self.window.rootViewController = frostedViewController;

I've drilled down the problem with REFrostedViewController. If I set rootViewController to transitionController, the layout is perfectly aligned.

Update2: So the fact is.. when a double status bar is present, ADTransitionController will set coordY = 20 and height = 548. REFrostedViewController does the same thing.. causing I have 40 margin on top.. One thing I'm not sure is.. when is the frame of these UIViews being set?

xialin
  • 7,686
  • 9
  • 35
  • 66
  • What happens in simulator if You toggle double status bar (command + Y) - does UI respond correctly? try it on multiple iOS simulators. – Guntis Treulands Jun 05 '14 at 07:34
  • @GuntisTreulands thanks for the quick reply. I tested it. It works when simply showing double status bar. the problem only happens in the scenario I described. I suspect it's something wrong during the launch – xialin Jun 05 '14 at 07:47
  • And if You test the case on simulator, where You set double status bar, and then run application? Hmm it might be device-only thing.. Did You know that You can get double statusbar also from iOS audio recorder? launch it, start recording, and then switch to Your application. Do it few times (turn off recording - switch, then turn on recording - switch) - check if Your app responds correctly to status bar changes while app is already launched. – Guntis Treulands Jun 05 '14 at 07:51
  • @GuntisTreulands ok, if I show double status bar before launching app on Simulator, same problem happens. – xialin Jun 05 '14 at 07:53
  • Ok, then Now You have a testbed on simulator to try to fix it.. Probably something in Your navigationcontroller/viewcontroller structure needs to be changed – Guntis Treulands Jun 05 '14 at 07:54
  • @GuntisTreulands what's the proper way of handling that? I mean all the apps should have handled this scenario... – xialin Jun 05 '14 at 07:56
  • Ofcourse. I've encountered this problem also, in some projects. It's like - it all should work as intended, but.. it doesn't. In that case I play around with navigation controller structure (For example, for iOS 6 (I think) It did not liked complicated navigationController structure, where top navigationController navigationBar is hidden. Thus I used custom navigation bar with height of 0 (visible result the same, but problem fixed). It really depends on the problem. And it is pretty hard to tell You how to fix it without actually seeing the code. – Guntis Treulands Jun 05 '14 at 08:04
  • Either provide the code where You create Your whole application navigationController/TabbarController/ViewController structure, or provide us with a demo project (empty project with the same navigationController structure (with the same problem) – Guntis Treulands Jun 05 '14 at 08:05
  • @GuntisTreulands I'm still investigating.. but apparently it's something wrong with REFrostedViewController (see my update). I will probably fix it myself. Thanks for the help :) – xialin Jun 05 '14 at 08:40
  • @MahmoudFayez can you explain? – xialin Jun 05 '14 at 10:03
  • http://stackoverflow.com/questions/9566789/remove-autolayout-constraints-in-interface-builder – Mahmoud Fayez Jun 06 '14 at 14:35
  • 1
    @MahmoudFayez that's not my problem. I don't even use storyboard... It turns out the problem lies in the 3rd party lib I'm using. I fixed it by setting position with reference to bounds instead of frame – xialin Jun 09 '14 at 05:38
  • @xialin, Have you managed to solve this issue? If Yes, than can you please write the answer. – JiteshW Feb 11 '16 at 11:20

0 Answers0