View controller view in tvOS

I am trying to present a view controller in a tvOS application, but not one of the code snippets included in it. What am I missing?

Code 1:

  DinoViewController *dinoVC = [[DinoViewController alloc]init]; dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentViewController:dinoVC animated:YES completion:nil]; 

Code 2:

  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; DinoViewController *dinoVC = [storyboard instantiateInitialViewController]; dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self presentViewController:dinoVC animated:YES completion:nil]; 
+6
source share
2 answers

Found the correct answer: Mention Identifier in the tvOS storyboard (not the same in iOS), and then implement this code:

  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *dinoVC = [storyboard instantiateViewControllerWithIdentifier:@"Page1"]; [self presentViewController:dinoVC animated:YES completion:nil]; 
+6
source

Please try this.

  DinoViewController *dinoVC = [[DinoViewController alloc]init]; dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [self showViewController:dinoVC sender:nil]; 

hope it will hope u

+1
source

All Articles