我用英语从服务器检索国家名称.例如,"西班牙"
我想要做的是,假设国家名称将用英文写,请获取国家代码.
我该怎么办?我发现从国家代码中获取国家名称非常简单,但我不知道如何进行相反的操作.
非常感谢.
我试图猜测某个字幕是否有可访问性选项来显示我正在处理的UI层中的信息.
我正在使用Apple的示例流bipbop:
https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8
Run Code Online (Sandbox Code Playgroud)
该播放列表有几个字幕,其中一些具有可访问性特征,例如:
EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound",URI="subtitles/eng/prog_index.m3u8"
Run Code Online (Sandbox Code Playgroud)
您可以看到它具有以下特征:
CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound"
Run Code Online (Sandbox Code Playgroud)
从应用程序的角度来看,我使用这段代码检索所有字幕:
AVMediaSelectionGroup * subtitleSelectionGroup = [asset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicLegible];
for (AVMediaSelectionOption * subtitleOption in subtitleSelectionGroup.options) {
NSLog(@"%@", subtitleOption);
}
Run Code Online (Sandbox Code Playgroud)
这是从我们讨论的字幕创建的AVMediaSelectionOption的输出:
<AVMediaSelectionKeyValueOption: 0x14785320, locale = en, mediaType = 'sbtl', tagged media characteristics = {public.accessibility.transcribes-spoken-dialog, public.accessibility.describes-music-and-sound}, title = English, default = YES>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,AVPlayer正在向我报告该字段中的信息
标记媒体特征= {public.accessibility.transcribes-speaking-dialog,public.accessibility.describes-music-and-sound}
因为我可以在NSLog的输出中看到它
问题是,如何从代码中查询?AVMediaSelectionOption类中是否有任何特定字段?找不到一个
谢谢!
我有一个基于菜单的导航.菜单是tableView.每当用户按下该表中的一个条目时,我想切换到另一个视图控制器,如果有任何视图被推送,我想先清理导航堆栈.
这就是我在做的事情
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[(UINavigationController *)self.tabBar.selectedViewController popToRootViewControllerAnimated:YES];
self.tabBar.selectedIndex = indexPath.row;
}
Run Code Online (Sandbox Code Playgroud)
但
self.tabBar.selectedIndex = indexPath.row;
Run Code Online (Sandbox Code Playgroud)
不要让popToRoot动画完成.有没有办法知道动画何时完成?
谢谢
我有一个委托,它会收到一条消息,删除一个以该项为参数的项目.我想显示确认AlertView,然后,如果用户按是,我想删除它.
所以,我拥有的是
被调用的委托方法:
- (void) deleteRecording:aRecording(Recording*)aRecording {
NSLog(@"Cancel recording extended view");
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: NSLocalizedString(@"Cancel recording",nil)
message: NSLocalizedString(@"Are you sure you want to cancel the recording?",nil)
delegate: self
cancelButtonTitle: NSLocalizedString(@"No",nil)
otherButtonTitles: NSLocalizedString(@"Yes",nil), nil];
[alert show];
[alert release];
}
Run Code Online (Sandbox Code Playgroud)
并且检查按下了哪个按钮的方法:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (buttonIndex) {
case 0:
{
NSLog(@"Delete was cancelled by the user");
}
break;
case 1:
{
NSLog(@"Delete deleted by user");
}
}
}
Run Code Online (Sandbox Code Playgroud)
所以,我的问题是,如何将aRecording参数从第一种方法发送到第二种方法呢?
非常感谢