Open syedrazackimran opened 6 years ago
To resolve this issue i use version 1.0.4 and fix it to Swift 4
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)
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.
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.
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.
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