Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKWebView as StackViewController item #39

Closed
giofid opened this issue Oct 2, 2017 · 1 comment
Closed

WKWebView as StackViewController item #39

giofid opened this issue Oct 2, 2017 · 1 comment

Comments

@giofid
Copy link

giofid commented Oct 2, 2017

Hi,
I am currently considering to use this good library in my project to show user inbox email. So, in the Demo App, I'm trying to add a WKWebView as StackViewController item in place of UITextView but web view is not shown. This's modified setupStackViewController method:

import WKWebKit

....

fileprivate func setupStackViewController() {
     let toFieldController = LabeledTextFieldController(labelText: "To:")
     firstField = toFieldController.view
     stackViewController.addItem(toFieldController)
     stackViewController.addItem(LabeledTextFieldController(labelText: "Subject:"))
        
     let webView = WKWebView()
     webView.loadHTMLString("This field automatically expands as you type, no additional logic required", baseURL: nil)
     webView.scrollView.isScrollEnabled = false
     stackViewController.addItem(webView, canShowSeparator: false)
        
     stackViewController.addItem(ImageAttachmentViewController())
 }

Debug View Hierarchy tells me Scrollable content size is ambiguous.
What I'm doing wrong?

Thanks for your help,
Giorgio

@klaaspieter
Copy link
Contributor

Sorry for the slow response. It looks like WKWebView has no intrinsic height. If you want it to become visible in the stack you'll need to manually set a height using something like webView.heightAnchor.constraint(equalToConstant: 200).isActive = true.

Closing this, feel free to re-open if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants