小编Raj*_*ant的帖子

在webViewDidFinishLoad上,我在swift3中得到了额外的高度

  EventWebView.frame.size = EventWebView.sizeThatFits(CGSize.zero)
  EventWebView.scrollView.isScrollEnabled = false;    
  var frame = EventWebView.frame;

  frame.size.width = EventTableView.frame.size.width-40;       // Your desired width here.
  frame.size.height = 1;        // Set the height to a small one.

  EventWebView.frame = frame;       // Set webView's Frame, forcing the Layout of its embedded scrollView with current Frame's constraints (Width set above).

        frame.size.height = EventWebView.scrollView.contentSize.height;  // Get the corresponding height from the webView's embedded scrollView.
     heightConstraint.constant = frame.size.height
Run Code Online (Sandbox Code Playgroud)

我的HTML内容是

测试人员为新创建的事件的测试说明。Tester对新创建的事件的测试说明。Tester对新创建的事件的测试说明。测试人员为新创建的事件的测试说明。Tester对新创建的事件的测试说明。Tester对Tester对新创建的事件的说明。Testing对Tester对新创建的事件的说明。Tester对新创建的事件的测试说明。Tester对Tester对新创建的事件的说明。Testing对Tester对新创建的事件的说明。Tester对新创建的事件的测试说明。Tester对Tester对新创建的事件的说明。Testing对Tester对新创建的事件的说明。Tester对新创建的事件的测试说明。Tester对新创建的事件的测试说明。测试人员为新创建的事件的测试说明。Tester对新创建的事件的测试说明。Tester对新创建的事件的测试说明。

\ n“

iphone uiwebview ios swift3

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

标签 统计

ios ×1

iphone ×1

swift3 ×1

uiwebview ×1