【问题标题】:Show next/previous in control center for UIWebView在 UIWebView 的控制中心显示下一个/上一个
【发布时间】:2016-04-15 13:52:50
【问题描述】:
当我在 UIWebView 中加载任何 youtube 视频时,控制中心的下一个/上一个按钮会消失。
我想通过在控制中心保留下一个/上一个按钮来在 UIWebView 中加载视频。
示例(没什么花哨的):
NSString *urlString = @"https://m.youtube.com/watch?v=Pn874kEc3IA";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
注意:在真实设备中的行为是相同的。
【问题讨论】:
标签:
ios
iphone
ipad
youtube
uiwebview
【解决方案1】:
您需要启用下一个和上一个曲目。
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)];