Skip to content

Commit

Permalink
fix icon not appear
Browse files Browse the repository at this point in the history
  • Loading branch information
yiwangwuqianfjp committed Jun 2, 2023
1 parent c1abea4 commit 0054e50
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
2 changes: 2 additions & 0 deletions iOS/AUIKit/Classes/Components/Player/AUIKaraokeSkipView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ open class AUIKaraokeSkipView: UIView {

lazy var cancleBtn: AUIButton = {
let theme = AUIButtonDynamicTheme()
theme.iconWidth = "Player.skipCancleButtonWidth"
theme.iconHeight = "Player.skipCancleButtonHeight"
theme.buttonWidth = "Player.skipCancleButtonWidth"
theme.buttonHeight = "Player.skipCancleButtonHeight"
theme.icon = ThemeAnyPicker(keyPath:"Player.playerLrcItemSkipItem")
Expand Down
28 changes: 25 additions & 3 deletions iOS/AUIKit/Classes/Core/Utils/Extension/UIImage+AUIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,34 @@ extension UIImage {
extension String {
public static func aui_imageFilePath(named: String) -> String? {
for path in AUIRoomContext.shared.themeResourcePaths {
let filePath = path.appendingPathComponent(named).path
return filePath
let filePath = path.appendingPathComponent(named).path.appendPngExentionIfEmpty()
if FileManager.default.fileExists(atPath: filePath) {
return filePath
}
}
if let filePath = ThemeManager.currentThemePath?.URL?.appendingPathComponent(named).path {
if let filePath = ThemeManager.currentThemePath?.URL?.appendingPathComponent(named).path.appendPngExentionIfEmpty() {
return filePath
}
return nil
}

private func appendPngExentionIfEmpty() -> String{
var url = URL(fileURLWithPath: self)
if url.pathExtension.isEmpty {
return appending(".png")
}
return self
}

}

extension URL {
public static func aui_imageFileURL(named: String) -> URL? {
if let path = String.aui_imageFilePath(named: named) {
return URL(fileURLWithPath: path)
}
return nil
}


}
6 changes: 1 addition & 5 deletions iOS/AUIKit/Classes/Widgets/Button/AUIButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,7 @@ open class AUIButton: UIButton {

@objc fileprivate func aui_setImage(_ image: String?, for state: UIControl.State) {
guard let image = image else { return }
if let filePath = String.aui_imageFilePath(named: image) {
var fileUrl = URL(fileURLWithPath: filePath)
if fileUrl.pathExtension.isEmpty {
fileUrl.appendPathExtension("png")
}
if let fileUrl = URL.aui_imageFileURL(named: image) {
self.sd_setImage(with: fileUrl, for: state)
}
}
Expand Down

0 comments on commit 0054e50

Please sign in to comment.