在tvOS用户向下滑动遥控器时显示的菜单中,在其他电影应用上显示"字幕,音频和信息",如何使用按钮创建另一个选项卡?
以下是我的代码:
AVMutableMetadataItem *titleMetadataItem = [[AVMutableMetadataItem alloc] init];
titleMetadataItem.locale = NSLocale.currentLocale;
titleMetadataItem.key = AVMetadataCommonKeyTitle;
titleMetadataItem.keySpace = AVMetadataKeySpaceCommon;
titleMetadataItem.value = @"The Title";
NSArray *externalMetadata = [[NSArray alloc] initWithObjects:titleMetadataItem, nil];
_player.player.currentItem.externalMetadata = externalMetadata;
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我如何在向下滑动菜单中创建一个按钮,AVPlayerViewController以便用户可以在关闭或打开字幕之间切换?我没有srt files嵌入视频中.相反,我有一个单独的subtitle parser,我在标签上显示它.我能够获取信息部分以显示文本,但有没有办法添加按钮?
或者我如何为视频添加字幕选项?这不起作用:
_player.requiresFullSubtitles = YES;
谢谢!
我正在创建一个测试tvOS应用程序.我有一个图像(在tableview之外),当"聚焦"没有被选中时,我希望图像改变...我知道苹果已经添加了几种聚焦方法.有人可以告诉我,当它处于"焦点"时,我将使用哪些方法来更改此图像?我将如何使用它?我会使用这种方法:
- (BOOL)tableView:(UITableView *)tableView canFocusRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
或者我会使用:
- (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator
Run Code Online (Sandbox Code Playgroud)
请告诉我!谢谢!
如何更改"聚焦"UITableView单元格的字体颜色?我现在有这个....
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
if (context.nextFocusedView) {
CategoryCell *cell = [self.categoryTableView dequeueReusableCellWithIdentifier:@"CategoryCell"];
[cell.categoryLbl setTextColor:[UIColor orangeColor]];
}
}
Run Code Online (Sandbox Code Playgroud)
我知道如果你想改变一个专注的UITableViewCell的背景,它将是:
- (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
[context.nextFocusedView setBackgroundColor:[UIColor clearColor]];
[context.previouslyFocusedView setBackgroundColor:[UIColor orangeColor]];
}
Run Code Online (Sandbox Code Playgroud) 在 Objective-C 中是否有正确的方法来编写没有返回值的块?我见过的所有例子都是有返回值的。有人还可以解释一下完成块和常规块之间的区别吗?我知道 ^ 意味着它是一个块,但是 (void) 之前的 + 不也意味着它是一个块吗?
当用户点击Apple TV遥控器上的暂停/播放按钮时,我正在尝试创建一个动作.我查看了文档,但Apple推荐的代码不起作用.这是我的代码如下.有人可以告诉我我做错了什么吗?需要考虑的事项:我正在使用AVPlayerMovieController并且我的代码中确实有另一个手势识别器,但是它是一个轻扫手势并且这个方法被调用,而不是暂停/播放.有人可以帮忙吗?
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
tap.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause]];
[self.view addGestureRecognizer:tap];
Run Code Online (Sandbox Code Playgroud)
谢谢