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

Popup OriginPoint coming from TabBar for reasons? #144

Open
swimnbird opened this issue Apr 28, 2022 · 1 comment
Open

Popup OriginPoint coming from TabBar for reasons? #144

swimnbird opened this issue Apr 28, 2022 · 1 comment

Comments

@swimnbird
Copy link

I have a situation to where the origin of the pop over is coming from my tab bar instead of the button itself. I assume this must be because I have the button within a PageViewController.
Possibly I should be using something other than 'sender.frame', but I don't know what.

    @IBAction func button1Action(_ sender: UIButton) {
        
        
        //Origin Point
        let originPoint = CGPoint(x: sender.frame.midX, y: sender.frame.maxY + 158) //(Y = down)
        
        let popoverView = UIView(frame: CGRect(x: 32, y: sender.bounds.maxY + 20, width: self.view.bounds.width - 64, height: 200))
        
        let textLabel = UILabel(frame: CGRect(x: +15, y: 0, width: popoverView.bounds.width - 15, height: popoverView.bounds.height))
        
        textLabel.lineBreakMode = .byWordWrapping
        textLabel.numberOfLines = 0
        textLabel.textColor = .white
        textLabel.text = "Use neutral framing of the events rather than perceptually colored language. eg:\n\n____ event occured.\n____ person said: '____'.\n____ object was altered in ____ way."
        textLabel.textAlignment = .left

        
        popoverView.addSubview(textLabel)
        
        
        let options: [PopoverOption] = [
            .cornerRadius(25),
            .color(.systemTeal)
        ]
        
        let popover = Popover(options: options)
        popover.show(popoverView, point: originPoint)

    }
@swimnbird
Copy link
Author

Hello...?

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

1 participant