Objective-C:如何使用AVPictureInPictureController

时间:2016-08-17 17:14:26

标签: objective-c xcode avplayer avplayerlayer picture-in-picture

我正在尝试为我的iPad应用设置图片,我有一个自定义视频播放器,因此我遵循以下示例代码:https://developer.apple.com/library/ios/samplecode/AVFoundationPiPPlayer/Introduction/Intro.html

我在Objective-C中实现了这个,下面的第二行代码给出了错误“在AVPictureInPictureController类型的对象上找不到Property isPictureInPictureSupported。

AVPictureInPictureController *controller = [[AVPictureInPictureController alloc]init];

if (controller.isPictureInPictureSupported) {

1 个答案:

答案 0 :(得分:1)

isPictureInPictureSupportedAVPictureInPictureController上的类方法,而非实例属性。所以你这样称呼它:

if ([AVPictureInPictureController isPictureInPictureSupported]) {