iOS 13 UIViewController doesn't state restore its modalPresentationStyle to fullscreen

215 Views Asked by At

I've adopted the new iOS 13 modal presentation style across most of the modals in my app, however one navigation controller doesn't really fit the new style well so I set it to

UIModalPresentationFullScreen

when presenting it which works fine.

I just noticed a bug that when my app undergoes state preservation and restoration whilst on a ViewController being presented modally its loaded back in after restoration with a modalPresentationStyle of UIModalPresentationPageSheet.

As built in properties of a ViewController their state restoration is Apple's responsibility and I guess they just missed out handling it properly.

Thankfully I've been able to fix the issue by adding the following to my existing state restoration handling

- (void)decodeRestorableStateWithCoder:(NSCoder *)aDecoder
{
  ...
  self.navigationController.modalPresentationStyle = UIModalPresentationFullScreen; 
}

Anyone else encountered this or got an alternative solution?

Cheers

0

There are 0 best solutions below