在 tvOS 中呈现视图控制器
Presenting a view controller in tvOS
我试图在 tvOS
应用程序中展示一个视图控制器,但是所包含的代码片段都没有展示一个。我错过了什么?
代码 1:
DinoViewController *dinoVC = [[DinoViewController alloc]init];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dinoVC animated:YES completion:nil];
代码 2:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
DinoViewController *dinoVC = [storyboard instantiateInitialViewController];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dinoVC animated:YES completion:nil];
请试试这个..
DinoViewController *dinoVC = [[DinoViewController alloc]init];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self showViewController:dinoVC sender:nil];
希望这会希望你
找到正确答案:在 tvOS storyboard 中提到 Identifier
,(iOS 中不一样),然后实现此代码:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *dinoVC = [storyboard instantiateViewControllerWithIdentifier:@"Page1"];
[self presentViewController:dinoVC animated:YES completion:nil];
我试图在 tvOS
应用程序中展示一个视图控制器,但是所包含的代码片段都没有展示一个。我错过了什么?
代码 1:
DinoViewController *dinoVC = [[DinoViewController alloc]init];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dinoVC animated:YES completion:nil];
代码 2:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
DinoViewController *dinoVC = [storyboard instantiateInitialViewController];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dinoVC animated:YES completion:nil];
请试试这个..
DinoViewController *dinoVC = [[DinoViewController alloc]init];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self showViewController:dinoVC sender:nil];
希望这会希望你
找到正确答案:在 tvOS storyboard 中提到 Identifier
,(iOS 中不一样),然后实现此代码:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *dinoVC = [storyboard instantiateViewControllerWithIdentifier:@"Page1"];
[self presentViewController:dinoVC animated:YES completion:nil];