From 2e9e6a801b50c15c28de98b4142a0cc25a439d81 Mon Sep 17 00:00:00 2001 From: DancewithPeng Date: Tue, 15 Jun 2021 09:59:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=8D=E6=AC=A1=E8=B0=83?= =?UTF-8?q?=E7=94=A8show(in:)=E6=96=B9=E6=B3=95=E4=B8=8D=E8=B5=B7=E4=BD=9C?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KBPopup.podspec | 2 +- KBPopup/Sources/KBPopupView.swift | 16 +++++++++------- README.md | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/KBPopup.podspec b/KBPopup.podspec index 2fba5bb..4f8ecd4 100644 --- a/KBPopup.podspec +++ b/KBPopup.podspec @@ -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带箭头的起泡弹窗,使用于需要在页面内弹窗的场景 diff --git a/KBPopup/Sources/KBPopupView.swift b/KBPopup/Sources/KBPopupView.swift index a54ac33..98060de 100644 --- a/KBPopup/Sources/KBPopupView.swift +++ b/KBPopup/Sources/KBPopupView.swift @@ -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) } @@ -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 @@ -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 @@ -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 diff --git a/README.md b/README.md index af47c15..b36e34a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ iOS带箭头的起泡弹窗 在`Podfile`文件中加入 ```ruby -pod 'KBPopup', '~> 1.0.0' +pod 'KBPopup', '~> 1.0.1' ```