0
votes

I have a presented controller where:

modalPresentationStyle = .Custom

I need to use portrait interface orientation or disable rotation for this view controller at all. In such methods as:

supportedInterfaceOrientations(), shouldAutorotate()

I return needed values but they do nothing, the controller still rotates when presented. When I use some system default modalPresentationStyle than there is expected behavior.

1

1 Answers

0
votes

just add these two functions in your custom view. Remove did rotate and will rotate methods or orientations if added. This will open in all orientation but did not changed after that, until you dismiss.

- (BOOL)shouldAutorotate{
    return NO;
}


- (NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAll; 
}