Popover icon indicating copy to clipboard operation
Popover copied to clipboard

Popup OriginPoint coming from TabBar for reasons?

Open swimnbird opened this issue 2 years ago • 2 comments

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 avatar Apr 28 '22 05:04 swimnbird

Hello...?

swimnbird avatar May 21 '22 11:05 swimnbird

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)



    }

Gguerrero1133 avatar Sep 13 '24 22:09 Gguerrero1133