小编Ser*_*urd的帖子

在iOS 10中获取Web视图的高度

我需要获得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中遇到此问题

javascript objective-c uiwebview ios

3
推荐指数
1
解决办法
1551
查看次数

在Swift中获取图像名称UIImagePickerController

我使用UIImagePickerController从手机库(iOS)获取图像.编辑模式后,我把图像放到我的UIImageView.我想将此图像保存在Core Data中,以便在另一个View Controllers中使用它

我怎么能在Swift中做到这一点.如果不可能有什么选项可以保存图像?

iphone xcode uiimageview ios swift

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×2

iphone ×1

javascript ×1

objective-c ×1

swift ×1

uiimageview ×1

uiwebview ×1

xcode ×1