答案 0 :(得分:1)
使用WebView的委托截取请求URL。您可以检查网址是否包含" .mp3"例如,然后加载自己的UIViewController实例。
专门拦截方法。
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
以下是您在ObjC中应该做的事情的一个例子。
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
if([request.URL.absoluteString containsString:@".mp3"]){
UIViewController *playViewController = [[UIViewController alloc] init];
[self.navigationController pushViewController:playViewController animated:YES];
return NO;
}
else
return YES; }
答案 1 :(得分:1)
如下所示,使用ViewController而不是settingsVC
<强>夫特强>
from collections import Counter
list1 = ['a', 'b', 'c']
list2 = ['a', 'b', 'c', 'b']
c1 = Counter(list1)
c2 = Counter(list2)
for key, count in c1.iteritems():
if c2[key] < count:
break
else:
print 'list2 has all the chracters in list1'