mirror of https://github.com/xaoxuu/ProHUD
兼容iOS13
This commit is contained in:
parent
ff28ddbdb1
commit
4072478569
|
@ -33,7 +33,8 @@ extension CapsuleTarget: DefaultLayout {
|
||||||
textLabel.snp.remakeConstraints { make in
|
textLabel.snp.remakeConstraints { make in
|
||||||
make.width.lessThanOrEqualTo(AppContext.appBounds.width * 0.5)
|
make.width.lessThanOrEqualTo(AppContext.appBounds.width * 0.5)
|
||||||
}
|
}
|
||||||
textLabel.snp.contentHuggingVerticalPriority = .infinity
|
textLabel.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
|
textLabel.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
textLabel.text = text
|
textLabel.text = text
|
||||||
textLabel.sizeToFit()
|
textLabel.sizeToFit()
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ extension CapsuleTarget {
|
||||||
|
|
||||||
config.cardCornerRadius = min(size.height / 2, config.cardCornerRadiusByDefault)
|
config.cardCornerRadius = min(size.height / 2, config.cardCornerRadiusByDefault)
|
||||||
contentView.layer.cornerRadiusWithContinuous = config.cardCornerRadiusByDefault
|
contentView.layer.cornerRadiusWithContinuous = config.cardCornerRadiusByDefault
|
||||||
view.layer.cornerRadiusWithContinuous = config.cardCornerRadiusByDefault
|
|
||||||
|
|
||||||
window.rootViewController = self // 此时toast.view.frame.size会自动更新为window.frame.size
|
window.rootViewController = self // 此时toast.view.frame.size会自动更新为window.frame.size
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,9 @@ open class CapsuleTarget: BaseController, HUDTargetType {
|
||||||
|
|
||||||
/// 内容容器(imageView、textLabel)
|
/// 内容容器(imageView、textLabel)
|
||||||
public lazy var contentStack: StackView = {
|
public lazy var contentStack: StackView = {
|
||||||
let stack = StackView()
|
let stack = StackView(axis: .horizontal)
|
||||||
stack.spacing = 8
|
stack.spacing = 8
|
||||||
stack.distribution = .equalCentering
|
|
||||||
stack.alignment = .center
|
stack.alignment = .center
|
||||||
stack.axis = .horizontal
|
|
||||||
config.customContentStack?(stack)
|
config.customContentStack?(stack)
|
||||||
return stack
|
return stack
|
||||||
}()
|
}()
|
||||||
|
@ -80,9 +78,6 @@ open class CapsuleTarget: BaseController, HUDTargetType {
|
||||||
|
|
||||||
open override func viewDidLoad() {
|
open override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
view.layer.shadowRadius = 8
|
|
||||||
view.layer.shadowOffset = .init(width: 0, height: 5)
|
|
||||||
view.layer.shadowOpacity = 0.1
|
|
||||||
|
|
||||||
// 点击
|
// 点击
|
||||||
let tap = UITapGestureRecognizer(target: self, action: #selector(_onTappedGesture(_:)))
|
let tap = UITapGestureRecognizer(target: self, action: #selector(_onTappedGesture(_:)))
|
||||||
|
|
|
@ -28,6 +28,9 @@ class CapsuleWindow: Window {
|
||||||
windowLevel = .phCapsuleBottom
|
windowLevel = .phCapsuleBottom
|
||||||
}
|
}
|
||||||
frame = .init(x: 0, y: 0, width: 128, height: 48)
|
frame = .init(x: 0, y: 0, width: 128, height: 48)
|
||||||
|
layer.shadowRadius = 8
|
||||||
|
layer.shadowOffset = .init(width: 0, height: 5)
|
||||||
|
layer.shadowOpacity = 0.1
|
||||||
isHidden = true
|
isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue