Skip to content

Commit

Permalink
修复再次调用show(in:)方法不起作用的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
DancewithPeng committed Jun 15, 2021
1 parent e9f127d commit 2e9e6a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion KBPopup.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "KBPopup"
spec.version = "1.0"
spec.version = "1.0.1"
spec.summary = "iOS带箭头的起泡弹窗"
spec.description = <<-DESC
iOS带箭头的起泡弹窗,使用于需要在页面内弹窗的场景
Expand Down
16 changes: 9 additions & 7 deletions KBPopup/Sources/KBPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,17 @@ open class KBPopupView: KBDecorationView {

public override init(contentView: UIView) {
super.init(contentView: contentView, contentInsets: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10))
self.backgroundColor = UIColor(white: 60/255.0, alpha: 1.0)
}

public override init(contentView: UIView, contentInsets: UIEdgeInsets) {
super.init(contentView: contentView, contentInsets: contentInsets)
self.backgroundColor = UIColor(white: 60/255.0, alpha: 1.0)
}

required public init?(coder: NSCoder) {
super.init(coder: coder)
self.backgroundColor = UIColor(white: 60/255.0, alpha: 1.0)
}


Expand Down Expand Up @@ -263,7 +266,7 @@ extension KBPopupView {
let animation = CABasicAnimation(keyPath: "opacity")
animation.fromValue = 0
animation.toValue = 1.0
animation.duration = 0.25
animation.duration = 0.15
animation.timingFunction = CAMediaTimingFunction(name : .easeInEaseOut)
animation.fillMode = .forwards
animation.isRemovedOnCompletion = false
Expand Down Expand Up @@ -300,7 +303,7 @@ extension KBPopupView {
let animation = CASpringAnimation(keyPath: "opacity")
animation.fromValue = 1.0
animation.toValue = 0
animation.duration = 0.25
animation.duration = 0.15
animation.timingFunction = CAMediaTimingFunction(name : .easeInEaseOut)
animation.fillMode = .forwards
animation.isRemovedOnCompletion = false
Expand Down Expand Up @@ -350,13 +353,12 @@ extension KBPopupView {
guard sourceViewFrame != .zero else {
return
}

guard self.superview != containerView else {
return
}

self.bounds = CGRect(x: 0, y: 0, width: self.intrinsicContentSize.width, height: self.intrinsicContentSize.height)
containerView.addSubview(self)

if self.superview != containerView {
containerView.addSubview(self)
}

let positionX: CGFloat
let positionY: CGFloat
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ iOS带箭头的起泡弹窗
`Podfile`文件中加入

```ruby
pod 'KBPopup', '~> 1.0.0'
pod 'KBPopup', '~> 1.0.1'
```


Expand Down

0 comments on commit 2e9e6a8

Please sign in to comment.