|
@@ -285,6 +285,7 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController,NSCo
|
|
|
|
|
|
self.collectionView.register(KMConvertCollectionViewHeader.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMAdvertisementCollectionViewItem"))
|
|
|
self.collectionView.register(KMBatchoperateConvertCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMBatchoperateConvertCollectionViewItem"))
|
|
|
+ self.collectionView.register(KMConvertCollectionViewHeader.self, forSupplementaryViewOfKind: NSCollectionView.elementKindSectionHeader, withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "convertHeader"))
|
|
|
|
|
|
collectionView.enclosingScrollView?.drawsBackground = false
|
|
|
let v = NSView(frame: NSRect(x: 0, y: 0, width: 100, height: 100))
|
|
@@ -518,17 +519,6 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController,NSCo
|
|
|
func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
|
return dataSourcesArray!.count
|
|
|
}
|
|
|
- func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
|
|
- let item = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMBatchoperateConvertCollectionViewItem"), for: indexPath) as! KMBatchoperateConvertCollectionViewItem
|
|
|
- item.updateInterface(dataSourcesArray![indexPath.item])
|
|
|
- return item
|
|
|
- }
|
|
|
- func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
|
|
|
- return NSSize(width: 74, height: 180)
|
|
|
- }
|
|
|
- func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, insetForSectionAt section: Int) -> NSEdgeInsets {
|
|
|
- return NSEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)
|
|
|
- }
|
|
|
func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>) {
|
|
|
if let indexPath = indexPaths.first {
|
|
|
convertType = dataSourcesArray![indexPath.item]
|
|
@@ -536,15 +526,15 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController,NSCo
|
|
|
}
|
|
|
}
|
|
|
func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> NSSize {
|
|
|
- return NSSize(width: 10000, height: 100)
|
|
|
+ return NSSize(width: 10000, height: 50)
|
|
|
}
|
|
|
func collectionView(_ collectionView: NSCollectionView, viewForSupplementaryElementOfKind kind: NSCollectionView.SupplementaryElementKind, at indexPath: IndexPath) -> NSView {
|
|
|
- let view = collectionView.makeSupplementaryView(ofKind: kind, withIdentifier:NSUserInterfaceItemIdentifier(rawValue: "convertHeader") , for: indexPath) as! KMConvertCollectionViewHeader
|
|
|
+ let view = collectionView.makeSupplementaryView(ofKind: kind, withIdentifier:NSUserInterfaceItemIdentifier(rawValue: "convertHeader") , for: indexPath) as? KMConvertCollectionViewHeader
|
|
|
|
|
|
- view.convertHeaderClickedCallBack = {
|
|
|
+ view?.convertHeaderClickedCallBack = {
|
|
|
self.convertActionVC()
|
|
|
}
|
|
|
- return view
|
|
|
+ return view ?? NSView()
|
|
|
}
|
|
|
|
|
|
func intConvertType(num: Int) -> KMConvertWithPDFType {
|
|
@@ -588,3 +578,17 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController,NSCo
|
|
|
return type!
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+extension KMBatchOperateConvertViewController: NSCollectionViewDelegateFlowLayout {
|
|
|
+ func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
|
|
|
+ let item = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMBatchoperateConvertCollectionViewItem"), for: indexPath) as! KMBatchoperateConvertCollectionViewItem
|
|
|
+ item.updateInterface(dataSourcesArray![indexPath.item])
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
|
|
|
+ return NSSize(width: 74, height: 80)
|
|
|
+ }
|
|
|
+ func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, insetForSectionAt section: Int) -> NSEdgeInsets {
|
|
|
+ return NSEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)
|
|
|
+ }
|
|
|
+}
|