ios - 如何重命名 AVPlayer 中的完成按钮?

标签 ios swift button avplayer live-streaming

我正在使用 Swift 3.0 开发一个应用程序,让用户有机会在线观看流媒体电视 channel 。当时它仅限于意大利,所以我试图用意大利语翻译应用程序中的每个按钮......但是我在顶部的完成按钮(和“直播”字段)上遇到了问题每当用户选择要流式传输的 channel 时出现的 AVPlayer 屏幕。我确定有一种方法可以编辑它们,因为当我在 Safari 中打开流时,“完成”按钮正确显示为“正常”,“直播”变成“Trasmissione in diretta”……我想看看他们也是这样,但我不知道如何才能达到这个目标。

我没有为播放器创建任何特定的类,只是创建了一个从 Storyboard到 AVPlayerController 的转接,并且我完全从包含 channel 的 TableView 管理流;这是我的重要代码:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "guardaCanale" {
        let destinazione = segue.destination as! AVPlayerViewController
        if let cellaCanaleSelezionata = sender as? CanaleTableViewCell {
            let indexPath = tableView.indexPath(for: cellaCanaleSelezionata)!
            let canaleSelezionato = ritornaIlCanaleCorretto(indexPath: indexPath)

            let url = URL(string: canaleSelezionato.urlCanale)
            if let streamingURL = url {
                destinazione.player = AVPlayer(url: streamingURL)

                // Il do-try-catch seguente serve per far funzionare l'audio dell'app anche se l'iPhone è in modalità silenziosa; togli il blocco per fare in modo che l'app non produca audio se l'iPhone è in modalità silenziosa
                do {
                    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
                } catch {
                    print("Errore: non riesco a riprodurre l'audio se iPhone è in modalità silenziosa.")
                }
                destinazione.player?.play()
            }
        }
    }
}

有人可以帮帮我吗?我不想修改“完成”按钮的行为,只需更改其在屏幕上的可见名称...希望有人能帮助我!太感谢了! :)

最佳答案

听起来您没有正确设置您的应用以进行意大利语本地化。

Apple 提供的 UI 元素的翻译基于设备的语言以及您的应用程序是否支持该语言。如果您将设备语言更改为意大利语,它应该会自动显示。

enter image description here

我建议阅读 Apple's Localization Documentation确保您正确设置您的应用,以便系统知道它已本地化为意大利语。

关于ios - 如何重命名 AVPlayer 中的完成按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40794082/

相关文章:

xcode - Assets 目录编译器错误 - 所有输入目录均不包含名为 "AppIcon"的匹配应用程序图标集

ios - 向 UILabel 添加填充

ios - UITableViewCell 中的 UICollectionView 重用

ios - UISearchController 的 UITableView 顶部的额外空间

listview - 调整平面按钮的大小并在 flutter 中提供水平滚动选项

css - Semantic-UI CSS 框架的主题

javascript - 如何将类更改为元素的nodeValue?我究竟做错了什么?

ios - SocketIOClient-Swift : Unable to authenticate socket server

ios - UIStepper.value 变成科学计数法

ios - 方法不会覆盖其父类(super class)中的任何方法