在UIWebView的控制中心中显示下一个/上一个 [英] Show next/previous in control center for UIWebView

查看:63
本文介绍了在UIWebView的控制中心中显示下一个/上一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在UIWebView中加载任何youtube视频时,控制中心中的下一个/上一个按钮将消失. 我想通过将下一个/上一个按钮保留在控制中心来在UIWebView中加载视频.

When i load any youtube video in UIWebView, the next/previous buttons in control centre become disappear. I want to load videos in UIWebView by keeping next/previous buttons in control centre.

示例(没什么好想的):

NSString *urlString = @"https://m.youtube.com/watch?v=Pn874kEc3IA";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];

注意::在实际设备中的行为是相同的.

NOTE: The behaviour is same in the real device.

推荐答案

您需要启用下一首和上一首曲目.

You need to enable next and previous tracks.

MPRemoteCommandCenter *rcc = [MPRemoteCommandCenter sharedCommandCenter];
MPRemoteCommand *nextTrackCommand = [rcc nextTrackCommand];
[nextTrackCommand setEnabled:YES];
[nextTrackCommand addTarget:self action:@selector(nextTrackCommandAction)];

MPRemoteCommand *previousTrackCommand = [rcc previousTrackCommand];
[previousTrackCommand setEnabled:YES];
[previousTrackCommand addTarget:self action:@selector(previousTrackCommandAction)];

这篇关于在UIWebView的控制中心中显示下一个/上一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆