123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import Foundation
- class NCActionSheetHeader: NSObject {
-
- @objc static let sharedInstance: NCActionSheetHeader = {
- let instance = NCActionSheetHeader()
- return instance
- }()
-
- let appDelegate = UIApplication.shared.delegate as! AppDelegate
- func actionSheetHeader(isDirectory: Bool, iconName: String, ocId: String, etag: String, text: String) -> UIView? {
-
- var image: UIImage?
-
-
- if isDirectory {
- image = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), multiplier: 3, color: NCBrandColor.sharedInstance.brandElement)
- } else if iconName.count > 0 {
- image = UIImage.init(named: iconName)
- } else {
- image = UIImage.init(named: "file")
- }
- if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(ocId, etag: etag)) {
- image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(ocId, etag: etag))
- }
-
- let headerView = UINib(nibName: "NCActionSheetHeaderView", bundle: nil).instantiate(withOwner: self, options: nil).first as! NCActionSheetHeaderView
-
- headerView.backgroundColor = NCBrandColor.sharedInstance.backgroundForm
- headerView.imageItem.image = image
- headerView.label.text = text
- headerView.label.textColor = NCBrandColor.sharedInstance.icon
-
- return headerView
- }
- }
|