|
@@ -65,7 +65,7 @@ class KMSubscribeWaterMarkView: KMBaseXibView {
|
|
|
self.titleLabel.font = NSFont.SFProTextSemibold(20)
|
|
|
|
|
|
self.waterExportButton.backgroundColor(NSColor(hex: "#EDEEF0"))
|
|
|
- self.waterExportButton.border(NSColor(hex: "#DFE1E5"), 0, 20)
|
|
|
+ self.waterExportButton.border(NSColor(hex: "#DFE1E5"), 1, 20)
|
|
|
self.waterExportButton.contentTintColor = NSColor(hex: "#252629")
|
|
|
self.waterExportButton.font = NSFont.SFProTextRegular(16)
|
|
|
|
|
@@ -131,26 +131,19 @@ extension KMSubscribeWaterMarkView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-extension KMSubscribeWaterMarkView {
|
|
|
- @IBAction func doneAction(_ sender: Any) {
|
|
|
-// guard let callBack = doneAction else { return }
|
|
|
-//
|
|
|
-// callBack(self, data)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
extension KMSubscribeWaterMarkView: NSCollectionViewDataSource {
|
|
|
public func numberOfSections(in collectionView: NSCollectionView) -> Int {
|
|
|
- return 1
|
|
|
+ return dataArray.count
|
|
|
}
|
|
|
|
|
|
public func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
|
- return dataArray.count
|
|
|
+ return 1
|
|
|
}
|
|
|
|
|
|
//返回对应的item自定义个体
|
|
|
public func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
|
|
let view = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMSubscribeWaterMarkCollectionItem"), for: indexPath) as! KMSubscribeWaterMarkCollectionItem
|
|
|
+ view.data = self.dataArray[indexPath.section]
|
|
|
return view
|
|
|
}
|
|
|
}
|
|
@@ -172,19 +165,21 @@ extension KMSubscribeWaterMarkView: NSCollectionViewDelegateFlowLayout {
|
|
|
public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
|
|
|
let data = self.dataArray[indexPath.section]
|
|
|
let string: NSString = data["title"]! as NSString
|
|
|
+ let subtitleString: NSString = data["subtitle"]! as NSString
|
|
|
|
|
|
let paragraphStyle = NSMutableParagraphStyle()
|
|
|
paragraphStyle.lineHeightMultiple = 1.32
|
|
|
paragraphStyle.alignment = .left
|
|
|
- let size: NSSize = string.boundingRect(with: NSSize(width: 232, height: 100), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : NSFont.SFProTextRegular(12), NSAttributedString.Key.paragraphStyle : paragraphStyle]).size
|
|
|
- return NSSize(width: 279, height: max(20, size.height))
|
|
|
+ let size: NSSize = string.boundingRect(with: NSSize(width: 356, height: 100), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : NSFont.SFProTextSemibold(14), NSAttributedString.Key.paragraphStyle : paragraphStyle]).size
|
|
|
+ let subtitleSize: NSSize = subtitleString.boundingRect(with: NSSize(width: 356, height: 100), options: NSString.DrawingOptions(rawValue: 3), attributes: [NSAttributedString.Key.font : NSFont.SFProTextRegular(12), NSAttributedString.Key.paragraphStyle : paragraphStyle]).size
|
|
|
+ return NSSize(width: 400, height: max(66, size.height + subtitleSize.height + 4))
|
|
|
}
|
|
|
|
|
|
public func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, insetForSectionAt section: Int) -> NSEdgeInsets {
|
|
|
if section == self.dataArray.count - 1 {
|
|
|
return NSEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
} else {
|
|
|
- return NSEdgeInsets(top: 0, left: 0, bottom: 12, right: 0)
|
|
|
+ return NSEdgeInsets(top: 0, left: 0, bottom: 20, right: 0)
|
|
|
}
|
|
|
}
|
|
|
}
|