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

updateOverlayText not working with blockingWaitOverlay #34

Open
childr3n opened this issue Jun 15, 2017 · 1 comment
Open

updateOverlayText not working with blockingWaitOverlay #34

childr3n opened this issue Jun 15, 2017 · 1 comment

Comments

@childr3n
Copy link

This code is not working :
let soView = SwiftOverlays.showBlockingWaitOverlayWithText("Original text")
SwiftOverlays.updateOverlayText(soView, text: "Updated text")

I think it's because a blockingWaitOverlay is containing two levels of containerViewTag before having the label. At this opposite of a traditional SwiftOverlay view.

To fix that I've temporary updated your updateOverlayText function this way, but I guess there's a more proper way to do it (or maybe i've missed another official trick to do it)

open class func updateOverlayText(_ parentView: UIView, text: String) {
    if let overlay = parentView.viewWithTag(containerViewTag) {
        for subview in overlay.subviews {
            if let label = subview as? UILabel {
                label.text = text as String
                break
            }
            
            if let subOverlay = subview.viewWithTag(containerViewTag) {
                
                for subSubView in subOverlay.subviews {
                    if let subLabel = subSubView as? UILabel {
                        subLabel.text = text as String
                        break
                    }
                }
                
            }
            
        }
    }
}
@peterprokop
Copy link
Owner

@childr3n thanks for the feedback, will fix that

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