3

I would like to know if anyone have an idea about a problem I have !

I have a simple viewController, with a custom appDelegate.window.frame (0, 20, width, height), with its own navigationController. I implemented a UIButton, that present an empty view controller.

UIViewController *v = [_controllersList objectAtIndex:indexPath.row];
        v.modalPresentationStyle = UIModalPresentationCurrentContext;
        [self presentViewController:v animated:YES completion:nil]; 

By now, everything is working. If I present that new controller (everything is fine with it!). When I dismiss the new view, my original view controller frame has changed graphically but not programmatically!

(The result is that my window is stuck to the top of the view, and cropped, with 20 blacks pixel to the bottom).

dandan78
  • 13,328
  • 13
  • 64
  • 78
UIChris
  • 601
  • 2
  • 6
  • 19
  • What iOS version are you testing on? Do you change(hide, show) status bar in your presenting view controller? – Fahri Azimov Sep 19 '13 at 06:54
  • I'm testing on iOS7 (everything is fine on iOS6). I have a 20 pixel height custom image as status bar, which stay visible even after the mofication of the frame =/ – UIChris Sep 19 '13 at 07:00
  • maybe this would be helpful to you: http://stackoverflow.com/questions/18294872/ios-7-status-bar-back-to-ios-6-style – Fahri Azimov Sep 19 '13 at 07:04
  • I already use that post to find a solution, but still have the problem :( – UIChris Sep 19 '13 at 07:07
  • I'm seeing a similar problem and have tracked it down to the fact that touches can be passed up to the presenting view controller's view. Is the presenting view controller, or its view, set up such that a touch action applied to it could cause the effect you are seeing? – Ash Dec 04 '13 at 10:46

4 Answers4

4

For me the solution was changing the default modalPresentationStyle property:

v.modalPresentationStyle = UIModalPresentationOverFullScreen;

Hope it helps.

Pedro Góes
  • 722
  • 6
  • 19
1

you can present the view controller from the window rootviewcontroller

[self.view.window.rootViewController presentViewController:v animated:YES completion:nil];
Chuy47
  • 2,391
  • 1
  • 30
  • 29
0

Check your Auto-Layout option. May be the issue for the auto-layout.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71
user1673099
  • 3,293
  • 7
  • 26
  • 57
-1

This solution will resolve your problem,when ever you Dismiss a view then view will appear will call every time.

-(void)viewWillAppear:(BOOL)animated {  

  self.view.frame = [[UIApplication sharedApplication].keyWindow bounds];
}
Romance
  • 1,416
  • 11
  • 21
  • Actually, this solution helped me to find my problem !! I was using the appDelegate.window bounds instead of the view.frame :D – UIChris Sep 19 '13 at 08:22
  • @user1147981 - Can you elaborate on the solution you found? I'm trying the fix above and it's not working in my case. – diegoreymendez Oct 07 '13 at 15:21
  • In my appdelegate, I'm moving my window's frame.origin.y by 20px. When I was dismissing my view controller, a library was reinitializing my frame (PPRevealSideView). So the 'trick' was to re-set the window.frame in my viewWillAppear methods when its frame was at 0, 0. I'm a clear ?? :) – UIChris Oct 13 '13 at 12:44
  • This seems a poor solution to me because you're not fixing the problem, you're wallpapering over it. Better to find out WHY the change is occurring and address that. – Ash Dec 04 '13 at 10:57