Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何将videoPlayer添加为子视图?_Iphone - Fatal编程技术网

Iphone 如何将videoPlayer添加为子视图?

Iphone 如何将videoPlayer添加为子视图?,iphone,Iphone,您好,我面临一个与添加子视图相关的问题; 我遵守守则: NSString*urlStr=[NSString stringWithFormat:@“http:x/iphone0.m3u8”]; NSURL*videoURL=[NSURL URLWithString:urlStr]; MPMoviePlayerController*iVideoPlayer=[[MPMoviePlayerController alloc]initWithContentURL:videoURL]; [self.view

您好,我面临一个与添加子视图相关的问题; 我遵守守则:

NSString*urlStr=[NSString stringWithFormat:@“http:x/iphone0.m3u8”];
NSURL*videoURL=[NSURL URLWithString:urlStr];
MPMoviePlayerController*iVideoPlayer=[[MPMoviePlayerController alloc]initWithContentURL:videoURL];
[self.view addSubview:iVideoPlayer.view];
if(UI\u USER\u INTERFACE\u IDIOM()==UIUserInterfaceIdiomPad)
{
//该设备是一台运行iPhone3.2或更高版本的iPad。
iVideoPlayer.view.frame=CGRectMake(353258320240);
}
其他的
{
iVideoPlayer.view.frame=CGRectMake(156,96168148);
}                   
[玩家游戏];
在这段代码中,我想添加一个视频播放器作为子视图。我已成功添加videoPlayer。但问题是,在视频播放过程中,如果我单击指定区域(CGRectMake(353258320240)),视频停止。我喜欢应用videoPlayer功能(下一步、暂停、音量增大/减小),但这些功能未完成。
如何解决此问题?

对于MPMoviePlayerController实例的控件样式,您有一些选项。通过将controlStyle属性设置为以下选项之一,您可以启用某些播放器控件(如暂停、播放等)

可在此处找到上述样式的说明:

下面是一个如何设置此属性的示例

[iVideoPlayer setControlStyle:MPMovieControlStyleEmbedded]

下面的答案有帮助吗?
[iVideoPlayer setControlStyle:MPMovieControlStyleEmbedded]