0

I have presented ViewController2 from viewController1 and rotated the device , modalviewcontroller (viewcontroller2) only rotating according to rotation but background presenting view controller is not rotating.

UIViewController *viewController2 = [UIViewController alloc]init];
self.presentationstyle = UIModalPresentationCurrentContext;    
[self presentViewController:viewController2 animated:YES];

please can anyone help me....

Vinay Jain
  • 2,644
  • 3
  • 26
  • 44
karan
  • 335
  • 4
  • 13

2 Answers2

0

Please do a research on stackoverflow itself before posting repeated questions. However I will provide you right pointers.

  1. Here is what you need to think about.
  2. Look here on the post from stackOverflow.
Community
  • 1
  • 1
Balram Tiwari
  • 5,657
  • 2
  • 23
  • 41
0

I have the same problem and maybe I can save others some time.

The short answer: I couldn't find a real solution.

The long answer: I consider it a bug. There are surprisingly few posts to find in the internet, so probably there are some yet unknown side-conditions to trigger this behavior. It only affects UIModalPresentationCurrentContext. If you don't need semi-transparence you can go for the other modes like UIModalPresentationFullScreen which work.

The resulting state is quite messy: statusBarOrientation reports the gui-orientation correct. Also the bounds have changed. Calling setNeedsLayout will result in a layout matching the real orientation in size but oriented the wrong way...

maybe it can be fixed setting a transformation to the view or by triggering the framework to reconsider its orientation by adding and removing a view with respective orientation-support-flags, or some other ugly workaround(Sadly there is no way of telling the framework directly to change orientation)

I resorted to a solution that uses addSubview instead of presentViewController.

moritz
  • 1
  • 1