EddyVerbruggen / cordova-plugin-safariviewcontroller

:tiger: :elephant: :crocodile: Forget InAppBrowser for iOS - this is way better for displaying read-only web content in your PhoneGap app
MIT License
281 stars 143 forks source link

Feature Request : ability to hide url and show only the web content. #158

Open T3Z3N opened 4 years ago

T3Z3N commented 4 years ago

can we have the ability to hide url and show only the web content.

allnash commented 4 years ago

Can you please apply the following?

let safariViewController = SFSafariViewController(URL: url)
presentViewController(safariViewController, animated: true) {
    var frame = safariViewController.view.frame
    let OffsetY: CGFloat  = 64
    frame.origin = CGPoint(x: frame.origin.x, y: frame.origin.y - OffsetY)
    frame.size = CGSize(width: frame.width, height: frame.height + OffsetY)
    safariViewController.view.frame = frame
}
presentViewController(svc, animated: true) {
    let width: CGFloat = 66
    let x: CGFloat = self.view.frame.width - width

    // It can be any overlay. May be your logo image here inside an imageView.
    let overlay = UIView(frame: CGRect(x: x, y: 20, width: width, height: 44))
    overlay.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
    svc.view.addSubview(overlay)
}
allnash commented 4 years ago

@EddyVerbruggen

EddyVerbruggen commented 4 years ago

I'd be happy to merge a PR! This looks like Swift, so I can't simply paste that into the project. And you may want to make it configurable through the JS API..

allnash commented 4 years ago

True. I am a little rusty on my ObjC. I can attempt it in the next month or so.

Scobee commented 3 years ago

@EddyVerbruggen was this ever implemented ?

EddyVerbruggen commented 3 years ago

No