我需要获得UIWebView高度.在方法webViewDidFinishLoad我有
CGFloat height1 = [[webView stringByEvaluatingJavaScriptFromString: @"document.body.scrollHeight"] floatValue];
CGFloat height2 = [[webView stringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"] floatValue];
CGFloat height3 = [[webView stringByEvaluatingJavaScriptFromString: @"document.body.clientHeight"] floatValue];
CGFloat height4 = [[webView stringByEvaluatingJavaScriptFromString: @"document.documentElement.clientHeight"] floatValue];
CGFloat height5 = [[webView stringByEvaluatingJavaScriptFromString: @"document.documentElement.scrollHeight"] floatValue];
CGFloat height6 = [[webView stringByEvaluatingJavaScriptFromString: @"document.documentElement.offsetHeight"] floatValue];
height = MAX(height1, MAX(height2, MAX(height3, MAX(height4, MAX(height5, height6)))));
Run Code Online (Sandbox Code Playgroud)
并且所有值都小于实际值 我只在iOS 10中遇到此问题
我使用UIImagePickerController从手机库(iOS)获取图像.编辑模式后,我把图像放到我的UIImageView.我想将此图像保存在Core Data中,以便在另一个View Controllers中使用它
我怎么能在Swift中做到这一点.如果不可能有什么选项可以保存图像?