nscollectionview

NSCollectionView memory leak in High Sierra?

依然范特西╮ 提交于 2020-12-30 07:33:21
问题 I have noticed a memory leak in NSCollectionView through Instruments. When I track down to the code, it shows the specific line below: collectionView.makeItem(withIdentifier: identifier, for: indexPath) as? DisplayableCellProtocol Then I looked it in Xcode, memory debugger, and find out there are some non-referenced items that caused the leak. However, not all items created by makeItem is leaking, some of them are normal, but some are not even shown. Managed normal unleaked item is like this

NSCollectionView memory leak in High Sierra?

血红的双手。 提交于 2020-12-30 07:31:58
问题 I have noticed a memory leak in NSCollectionView through Instruments. When I track down to the code, it shows the specific line below: collectionView.makeItem(withIdentifier: identifier, for: indexPath) as? DisplayableCellProtocol Then I looked it in Xcode, memory debugger, and find out there are some non-referenced items that caused the leak. However, not all items created by makeItem is leaking, some of them are normal, but some are not even shown. Managed normal unleaked item is like this

NSCollectionView memory leak in High Sierra?

依然范特西╮ 提交于 2020-12-30 07:31:44
问题 I have noticed a memory leak in NSCollectionView through Instruments. When I track down to the code, it shows the specific line below: collectionView.makeItem(withIdentifier: identifier, for: indexPath) as? DisplayableCellProtocol Then I looked it in Xcode, memory debugger, and find out there are some non-referenced items that caused the leak. However, not all items created by makeItem is leaking, some of them are normal, but some are not even shown. Managed normal unleaked item is like this

NSCollectionView memory leak in High Sierra?

元气小坏坏 提交于 2020-12-30 07:30:18
问题 I have noticed a memory leak in NSCollectionView through Instruments. When I track down to the code, it shows the specific line below: collectionView.makeItem(withIdentifier: identifier, for: indexPath) as? DisplayableCellProtocol Then I looked it in Xcode, memory debugger, and find out there are some non-referenced items that caused the leak. However, not all items created by makeItem is leaking, some of them are normal, but some are not even shown. Managed normal unleaked item is like this

Prevent NSCollectionView 'lifting' an item during drag

十年热恋 提交于 2020-04-11 08:32:07
问题 I understand how to get drag and drop working for NSCollectionView but I can't seem to stop it 'lifting' the items off the view. My current solution is to not implement func collectionView(_ collectionView: NSCollectionView, pasteboardWriterForItemAt indexPath: IndexPath) -> NSPasteboardWriting? from NSCollectionViewDelegate to ensure that func collectionView(_ collectionView: NSCollectionView, draggingImageForItemsAt indexPaths: Set<IndexPath>, with event: NSEvent, offset dragImageOffset:

NSCollectionView sizeForItemAt always returning exception when trying to reference an item in its collection

走远了吗. 提交于 2020-02-24 11:25:30
问题 Context - I am working on a macOS menu bar app which displays a collection of items. The items exist in a collection view and contain a textfield. Right now, the collection view layout is at a fixed height of 50, and I am trying to dynamically increase the size of the cell based on the size of the textfield. I believe the best way to do this is in the sizeForItemAt method, but I can not seem to reference a cell and its textfield to calculate and return it's height. Whenever I try and get a

NSCollectionView sizeForItemAt always returning exception when trying to reference an item in its collection

南楼画角 提交于 2020-02-24 11:25:07
问题 Context - I am working on a macOS menu bar app which displays a collection of items. The items exist in a collection view and contain a textfield. Right now, the collection view layout is at a fixed height of 50, and I am trying to dynamically increase the size of the cell based on the size of the textfield. I believe the best way to do this is in the sizeForItemAt method, but I can not seem to reference a cell and its textfield to calculate and return it's height. Whenever I try and get a

NSCollectionView - dragging shows a “hole” - want it to look lke the Finder

巧了我就是萌 提交于 2020-02-21 05:39:31
问题 I have an NSCollectionView. When I drag items (around the view, or outside of the view), I get the right appearance, but the cell is empty while the dragging occurs (see animated GIF below). The desired behavior is to be like the Finder - that is, the icon should remain in place and the dragged image appears in addition to it. I have tried a variety of things to no avail. For example, I tried setting the drag operation to Copy in sourceOperationMaskForDraggingContext. Can't remember the other

NSCollectionView - dragging shows a “hole” - want it to look lke the Finder

放肆的年华 提交于 2020-02-21 05:38:42
问题 I have an NSCollectionView. When I drag items (around the view, or outside of the view), I get the right appearance, but the cell is empty while the dragging occurs (see animated GIF below). The desired behavior is to be like the Finder - that is, the icon should remain in place and the dragged image appears in addition to it. I have tried a variety of things to no avail. For example, I tried setting the drag operation to Copy in sourceOperationMaskForDraggingContext. Can't remember the other

NSCollectionView custom layout enable scrolling

纵然是瞬间 提交于 2020-01-31 05:28:44
问题 I can't get scrolling both vertically and horizontally to work with a custom layout for NSCollectionView. According to the docs, in my subclass I return the `collectionViewContentSize' and if that is too big, scrolling is automatically enabled in the enclosing scroll view of the collection view. However, even if I order all elements in a horizontal row, only vertical scrolling is enabled. Here is a screenshot: http://i.stack.imgur.com/tMbCN.png Here is my layout code: import Cocoa class