兼容iOS13

This commit is contained in:
xaoxuu 2023-08-24 18:32:20 +08:00
parent ff28ddbdb1
commit 4072478569
4 changed files with 6 additions and 8 deletions

View File

@ -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()
} }

View File

@ -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.sizewindow.frame.size window.rootViewController = self // toast.view.frame.sizewindow.frame.size

View File

@ -15,11 +15,9 @@ open class CapsuleTarget: BaseController, HUDTargetType {
/// imageViewtextLabel) /// imageViewtextLabel)
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(_:)))

View File

@ -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
} }