Open swimnbird opened 2 years ago
Hello...?
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) }
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.