ios 小知识
键盘事件监听 UIKeyboardWillShowNotification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShown:) name:UIKeyboardWillShowNotification object:nil];
keyboardWillShown 方法中NSValue *value = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
[value CGRectValue].size; 键盘大小
网页是否包含视频
NSString * hasVideoTestString = @"document.documentElement.getElementsByTagName(\"video\").length"; NSString * result = [self stringByEvaluatingJavaScriptFromString:hasVideoTestString]; hasVideoTag = [result integerValue] >= 1? YES : NO;
播放视频 letv 1905 土豆 优酷 ok 其他没测试
@"document.documentElement.getElementsByTagName(\"video\")[0].play()"
//为了捕获到滚动事件 获取<span style="font-family: Arial, Helvetica, sans-serif;">webView的滚动事件</span> NSArray* arr = [self.webView subviews]; UIScrollView* sView = [arr objectAtIndex:0]; [sView setOpaque:NO]; sView.delegate = self;
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:NO];
//停止web加载 部分网页会加载失败 会屏蔽掉部分一直在后台运行的js
[webView stopLoading];
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。