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

Arrow Missing #101

Open syedrazackimran opened 6 years ago

syedrazackimran commented 6 years ago

I tried to implement ur pod but I'm facing some issues. Arrow point is missing kindly do needfully, I added screen and codes check it

var popOverOptions : [PopoverOption] = [ .type(.down), .springDamping(0.7), .initialSpringVelocity(3.0), .cornerRadius(6.0), .blackOverlayColor(UIColor(white: 0.0, alpha: 0.6)), .sideEdge(20.0), .arrowSize(CGSize(width: 12, height: 6)) ]

let startPoint = CGPoint(x: self.view.bounds.width - 60 , y: 55 ) let tableView = UITableView(frame: CGRect(x: 0, y: 0, width: Int(self.view.frame.width - 40) , height: 42 * self.options.count)) tableView.delegate = self tableView.dataSource = self tableView.isScrollEnabled = false tableView.tableFooterView = UIView() self.popover = Popover(options: self.popOverOptions) self.popover.show(tableView, point: startPoint) return

simulator screen shot - iphone 6 - 2018-01-03 at 16 34 54

tuanmoza commented 6 years ago

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

mdflores commented 6 years ago

Same here seems the arrow is not showing.. Using Popover (1.2.0)

let customPopoverView = CustomPopover.instanceFromNib() customPopoverView.frame = CGRect(origin: startingPoint, size: defaultFrameSize) let options = [ .type(.down), .animationIn(0.3), .color(primaryTint), .arrowSize(CGSize(width: 16.0, height: 10.0)) ] as [PopoverOption] let tooltip = Popover(options: options, showHandler: nil, dismissHandler: nil) tooltip.show(customPopoverView, point: startingPoint)

romitmewada commented 6 years ago

I found a temporary solution. Arrow is below view you added

let aView = UIView(frame: CGRect(x: 0, y: 0, width: width, height: 180))

let myViewObject = ////get instance
myViewObject.frame = CGRect.init(x: 0, y: 10, width:width, height: 170)
aView.addSubview(myViewObject)

popover.show(aView, point: startPoint)

Hope this is helpful for someone.

Cu-Toof commented 5 years ago

Just remove a below code in Popover file:

override open func layoutSubviews() {
        super.layoutSubviews()
        self.contentView.frame = self.bounds
    }

Because the code is set frame's contentView that is equal frame's superview, and not space for drawing arrow.

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
}

Use mask layer replace fill.