【发布时间】:2016-02-27 12:42:55
【问题描述】:
有谁知道如何通过单击 tvOS 上的“菜单”按钮来启用已呈现的 UIAlertViewController?
Apple TV 4 上的设置应用程序具有该行为,但默认情况下在我的应用程序中不起作用。我使用以下代码来创建用户可以执行的操作,但希望他不选择任何内容并通过按遥控器上的“菜单”按钮返回。
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Alert"
message:@"Please make a choice"
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* action1 = [UIAlertAction actionWithTitle:@"Option 1" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {}];
[alert addAction:action1];
UIAlertAction* action2 = [UIAlertAction actionWithTitle:@"Option 2" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {}];
[alert addAction:action2];
[self presentViewController:alert animated:YES completion:nil];
提前致谢。
【问题讨论】:
标签: objective-c cocoa tvos