Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 46 lines (26 sloc) 3.478 kb
0106cd3 Initial commit after separated from Fontcase
Pieter Omvlee authored
1 # BCCollectionView
2
3 BCCollectionView is intended as a replacement for NSCollectionView (and possibly IKImageBrowserView). It is designed to work with a lot of items and only loads the views that it actually needs.
4
5 Unlike NSCollectionView, BCCollectionView smoothly displays 300.000+ items.
6 Every 'cell' in an BCCollectionView is an NSViewController. At the moment these are only uniform; every cell is supposed to be the same NSViewController subclass.
7
8 # High-level concept overview of BCCollectionView
9
10 - The delegate provides empty NSViewControllers for the BCCollectionView that will be reused as often as needed; you can already style the view in it to a creation degree but the delegate doesn't know yet which item it will be displaying later.
11
12 - (NSViewController *)reusableViewControllerForIconView:(BCCollectionView *)iconView
13
14 - Before BCCollectionView shows them, it asks the delegate to populate an NSViewController with an item from its contentArray; this is the time to set labels or images that are dependent on the item its supposed to represent
15
16 - (void)iconView:(BCCollectionView *)iconView willShowViewController:(NSViewController *)viewController forItem:(id)anItem
17
18 - When the user scrolls the view, some views will become invisible. BCCollectionView removes them from view and stores them for later use. The delegate has a chance to unload any item-specific resources the item, possibly to save memory for example or do other kinds of cleanup
19
20 - (void)iconView:(BCCollectionView *)iconView viewControllerBecameInvisible:(NSViewController *)viewController
21
22 - If the categories on BCCollectionView are included too, the users can use either mouse or keyboard to select items. By default, BCCollectionView will (for now) just draw a rather ugly bezel under a view if it is selected. The delegate can customise this behaviour by return NO in:
23
24 - (BOOL)iconViewShouldDrawSelections:(BCCollectionView *)iconView
25
26 If the delegate also overrides the following two methods it can customise its view to determine how to show a selected item instead:
27
28 - (void)iconView:(BCCollectionView *)iconView updateViewControllerAsSelected:(NSViewController *)viewController forItem:(id)item;
29 - (void)iconView:(BCCollectionView *)iconView updateViewControllerAsDeselected:(NSViewController *)viewController forItem:(id)item;
30
31 Note. Do not use the following methods to style viewControllers. They are intended to inform the delegates of changes in the selection. Using these methods to style the viewControllers might break when the views are being reused at a later point.
32
33 - (BOOL)iconView:(BCCollectionView *)iconView shouldSelectItem:(id)anItem withViewController:(NSViewController *)viewController;
34 - (void)iconView:(BCCollectionView *)iconView didSelectItem:(id)anItem withViewController:(NSViewController *)viewController;
24aac01 @pieteromvlee Adds BSD license notice to the readme file
pieteromvlee authored
35 - (void)iconView:(BCCollectionView *)iconView didDeselectItem:(id)anItem withViewController:(NSViewController *)viewController;
36
d7a1dfd @pieteromvlee Updated Readme File
pieteromvlee authored
37 # Groups
38
39 The latest addition to BCCollectionView has to with groups. Just like IKImageBrowserView, we can now divide the items into groups. A group is simply a range with a title, and the delegate can supply a custom NSViewController to represent the header.
40 Groups can be set using the default way to load the BCCollectionView:
41
42 - (void)reloadDataWithItems:(NSArray *)newContent groups:(NSArray *)newGroups emptyCaches:(BOOL)shouldEmptyCaches;
43
24aac01 @pieteromvlee Adds BSD license notice to the readme file
pieteromvlee authored
44 # License
45
46 BCCollectionView is licensed under the BSD license
Something went wrong with that request. Please try again.