123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import Foundation
- class NCActionSheetHeader: NSObject {
-
- static let shared: 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 = UIImage.init(named: "folder")?.image(color: NCBrandColor.shared.brandElement, size: UIScreen.main.bounds.width)
- } 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.shared.backgroundForm
- headerView.imageItem.image = image
- headerView.label.text = text
- headerView.label.textColor = NCBrandColor.shared.icon
-
- return headerView
- }
- }
|