【问题标题】:Setting Label in iPhone's Lock screen Playback Controls在 iPhone 的锁屏播放控件中设置标签
【发布时间】:2011-11-08 17:09:53
【问题描述】:

在使用 AVAudioSession 时,如何将锁屏播放控件中的标签设置为我当前正在播放的音频剪辑的标题?基本上,我希望标签看起来与显示歌曲名称的 iPod 应用程序的锁定屏幕播放控件相同。目前,我的应用在我要更改的标签中显示应用名称。

【问题讨论】:

    标签: ios


    【解决方案1】:

    在 iOS 5 中您可以使用以下代码:

    Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
    
    if (playingInfoCenter) {
        MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
        NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys:
                                  @"Some artist", MPMediaItemPropertyArtist,
                                  @"Some title", MPMediaItemPropertyTitle,
                                  @"Some Album", MPMediaItemPropertyAlbumTitle,
                                  nil];
        center.nowPlayingInfo = songInfo;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-01-13
      • 1970-01-01
      • 2012-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多