杨锴
2024-11-06 63f7ed967433acee3ae8764c7a077e15c29c41f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
//  CLImageHelper.swift
//  CLPlayer
//
//  Created by Chen JmoVxia on 2021/10/27.
//
 
import UIKit
 
public class CLImageHelper: NSObject {
    public static func imageWithName(_ name: String) -> UIImage? {
        let filePath = Bundle(for: classForCoder()).resourcePath! + "/CLPlayer.bundle"
        let bundle = Bundle(path: filePath)
        let scale = max(min(Int(UIScreen.main.scale), 2), 3)
        return .init(named: "\(name)@\(scale)x", in: bundle, compatibleWith: nil)
    }
}