UIViewController - UIModalPresentationCurrentContext does not rotate presentingViewController

I used a UIViewController from another UIViewController with a presentation style of UIModalPresentationCurrentContext . But this will not let me rotate the presentingviewcontroller (The UIViewController that introduced the new UIViewController )

 self.modalPresentationStyle = UIModalPresentationCurrentContext; NewViewController *newViewController = [[NewViewController alloc] initWithNibName:@"NewViewController" Bundle: nil]; [self presentViewController:newViewController animated:YES completion:nil]; 

When I rotate the device, it will rotate the newViewController and statusbar , but not presentingviewcontroller

PS: Here, presentingviewcontroller is self .

enter image description here

+8
ios objective-c iphone uiviewcontroller ipad
source share
1 answer

Use UIModalPresentationFormSheet instead of UIModalPresentationCurrentContext

try it

self.modalPresentationStyle = UIModelPresentationFormSheet; NewViewController *newViewController = [[NewViewController alloc] initWithNibName:@"NewViewController" Bundle: nil]; [self presentViewController:newViewController animated:YES completion:nil];

0
source share

All Articles