2

I'm seeing times when self.traitCollection is undefined in viewDidLoad:

If I do the following simple presentation - the traits are NOT set (in viewDidLoad:)

TableViewController* vc = [[TableViewController alloc] initWithStyle:UITableViewStylePlain];
vc.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:vc animated:YES completion:nil];

However, if I use UIModalPresentationCurrentContext the traits ARE set (in viewDidLoad:)

Stranger still - if I insert a navigation controller as follows, the traits ARE set (in viewDidLoad: even with FullScreen presentation mode)

TableViewController* vc = [[TableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:vc];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nav animated:YES completion:nil];

Obviously my 'solution' is to use CurrentContext - but I'm not clear whether this is a bug or a gap in my understanding. Any pointers would be most welcome.

I'm using iOS 8.3

Thanks

Scotty
  • 2,019
  • 1
  • 20
  • 31
  • A note for people interested in an answer: this question has been answered in the Apple Developer Forums https://forums.developer.apple.com/thread/7854 – Sean Dawson Sep 03 '15 at 01:58

0 Answers0