corin8823 / Popover

Popover is a balloon library like Facebook app. It is written in pure swift.
MIT License
2.09k stars 326 forks source link

Pop Arrow disappears when table view pop over drawn below its button #96

Open ZalakSA opened 6 years ago

ZalakSA commented 6 years ago

I want table view pop over below its button but when I make it down arrow disappears

Here is my code:-

  let startPoint = CGPoint(x: self.view.frame.width - 60, y: self.rightButtomButton.frame.origin.y + self.rightButtomButton.frame.size.height)

    let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 135))
    tableView.delegate = self
    tableView.dataSource = self
    tableView.isScrollEnabled = false
    let popover1 = Popover(options: nil, showHandler: nil, dismissHandler: nil)

    popover1.show(tableView, point: startPoint)

Here is screen shot:- simulator screen shot - iphone 8 - 2017-10-31 at 18 48 23

Why I am not able to get arrow in case of table view ? If delegate & datasource not given then arrow will appear.

Please guide me.

Thanks, Zalak

nandantal commented 6 years ago

Have u found any solution to this ?

l12ab commented 6 years ago

yes i have this issue too, so fall bak to version 1.0.4

alexsteinerde commented 6 years ago

+1

nandantal commented 6 years ago

To fix it on this version, create one UIView and add items programmatically . Don't use tableview

corin8823 commented 6 years ago

It is displayed in the demo project, but where is the difference?

salvasp commented 6 years ago

Try to set the arrow size with the options

popover = Popover(
                    options: [
                        .type(PopoverType.down),
                        PopoverOption.blackOverlayColor(UIColor.black.withAlphaComponent(0.7)),
                        PopoverOption.sideEdge(8),
                        PopoverOption.arrowSize(CGSize(width: 12, height: 6))], //here
                    showHandler: nil, dismissHandler: nil)
arizale commented 6 years ago

you just need to clear background of view actually

kramsretep commented 6 years ago

I discovered that commenting out Popover.layoutSubviews() fixes this problem. I don't know if that breaks other use cases, however.

The change offered by salvasp above doesn't work for me.

Maxatma commented 6 years ago

I have same too. Also backed to 1.0.4

ktinguer commented 6 years ago

I have the same issue, I'm using swift 4

tuanmoza commented 6 years ago

To resolve this issue i use version 1.0.4 and fix it to Swift 4

chetan-duke commented 1 year ago

Any luck so far with latest version?

CoderFenchHU commented 10 months ago
 override open func draw(_ rect: CGRect) {
  ...

     color.setFill()
     //        arrow.fill()
     let maskLayer = CAShapeLayer()
     maskLayer.path = arrow.cgPath
     self.layer.mask = maskLayer
}

try to use Mask replay Fill