diff --git a/ylgamehall/Assets.xcassets/shareDouyin.imageset/Contents.json b/ylgamehall/Assets.xcassets/shareDouyin.imageset/Contents.json new file mode 100644 index 0000000..55a6335 --- /dev/null +++ b/ylgamehall/Assets.xcassets/shareDouyin.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "shareDouyin.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "shareDouyin@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "shareDouyin@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin.png b/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin.png new file mode 100644 index 0000000..e39ea4b Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin.png differ diff --git a/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin@2x.png b/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin@2x.png new file mode 100644 index 0000000..b9b589c Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin@2x.png differ diff --git a/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin@3x.png b/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin@3x.png new file mode 100644 index 0000000..bafd499 Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareDouyin.imageset/shareDouyin@3x.png differ diff --git a/ylgamehall/Assets.xcassets/shareQQ.imageset/Contents.json b/ylgamehall/Assets.xcassets/shareQQ.imageset/Contents.json new file mode 100644 index 0000000..ab721d6 --- /dev/null +++ b/ylgamehall/Assets.xcassets/shareQQ.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "shareQQ.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "shareQQ@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "shareQQ@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ.png b/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ.png new file mode 100644 index 0000000..f93fa44 Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ.png differ diff --git a/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ@2x.png b/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ@2x.png new file mode 100644 index 0000000..fc8d964 Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ@2x.png differ diff --git a/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ@3x.png b/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ@3x.png new file mode 100644 index 0000000..3f3d6d5 Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareQQ.imageset/shareQQ@3x.png differ diff --git a/ylgamehall/Assets.xcassets/shareWechat.imageset/Contents.json b/ylgamehall/Assets.xcassets/shareWechat.imageset/Contents.json new file mode 100644 index 0000000..3612a2f --- /dev/null +++ b/ylgamehall/Assets.xcassets/shareWechat.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "shareWechat.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "shareWechat@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "shareWechat@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat.png b/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat.png new file mode 100644 index 0000000..700805b Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat.png differ diff --git a/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat@2x.png b/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat@2x.png new file mode 100644 index 0000000..73c3115 Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat@2x.png differ diff --git a/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat@3x.png b/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat@3x.png new file mode 100644 index 0000000..94ae88d Binary files /dev/null and b/ylgamehall/Assets.xcassets/shareWechat.imageset/shareWechat@3x.png differ diff --git a/ylgamehall/Source/Share/SharePanel.swift b/ylgamehall/Source/Share/SharePanel.swift index 3ec1bbe..0a425cb 100644 --- a/ylgamehall/Source/Share/SharePanel.swift +++ b/ylgamehall/Source/Share/SharePanel.swift @@ -88,23 +88,23 @@ public final class SharePanel: UIView { let buttonsContainer = UIView(frame: CGRect(x: 0, y: 30, width: screen.width, height: 110)) contentView.addSubview(buttonsContainer) - let buttons: [(title: String, platform: SharePlatform, color: UIColor)] = [ - ("微信", WechatShare.shared, UIColor(red: 0.06, green: 0.69, blue: 0.36, alpha: 1)), - ("QQ", QQShare.shared, UIColor(red: 0.12, green: 0.51, blue: 0.97, alpha: 1)), - ("抖音", DouyinShare.shared, .black) + let buttons: [(title: String, platform: SharePlatform, imageName: String)] = [ + ("微信", WechatShare.shared, "shareWechat"), + ("QQ", QQShare.shared, "shareQQ"), + ("抖音", DouyinShare.shared, "shareDouyin") ] let totalButtonsWidth = Self.buttonSize * CGFloat(buttons.count) let spacing = (screen.width - totalButtonsWidth) / CGFloat(buttons.count + 1) for (index, b) in buttons.enumerated() { let x = spacing + CGFloat(index) * (Self.buttonSize + spacing) - let button = UIButton(type: .system) + let button = UIButton(type: .custom) button.frame = CGRect(x: x, y: 0, width: Self.buttonSize, height: Self.buttonSize) - button.backgroundColor = b.platform.isInstalled ? b.color : .lightGray + button.setImage(UIImage(named: b.imageName), for: .normal) + button.imageView?.contentMode = .scaleAspectFit button.layer.cornerRadius = Self.buttonSize / 2 - button.setTitle(b.title.prefix(1).description, for: .normal) - button.setTitleColor(.white, for: .normal) - button.titleLabel?.font = .systemFont(ofSize: 22, weight: .medium) + button.clipsToBounds = true + button.alpha = b.platform.isInstalled ? 1.0 : 0.4 button.tag = index button.addTarget(self, action: #selector(handleButtonTap(_:)), for: .touchUpInside) buttonsContainer.addSubview(button)