SMGridViewDataSource Protocol Reference
Conforms to | NSObject |
Declared in | SMGridView.h |
Tasks
-
– smGridView:numberOfItemsInSection:
Number of items in a section
required method -
– smGridView:sizeForIndexPath:
Size of a view in a given indexPath
required method -
– smGridView:viewForIndexPath:
You should use dequeReusableView or dequeReusableViewWithClass: inside this method for better performance
required method -
– smGridView:numberOfRowsInSection:
Use this method if your sections contain different number of rows. Otherwise you can use numberOfRows property
-
– smGridView:shouldMoveItemFrom:to:
This method will be called when the user sorts the grid. DataSource should update its data accordingly
-
– smGridView:performRemoveIndexPath:
This method will be called when a remove animation is finished.
SMGridViewDataSource
should remove the item at indexPath position in the implementation of this method -
– smGridViewShowLoader:
Use this method to decide wether to show a loader or not. Typically you make your
SMGridViewDataSource
manage this method and returningYES
orNO
if it is loading more content. -
– smGridView:willQueueView:
This is being called whenever a view is queued. Use this to stop animations, clean…
-
– smGridViewSameSize:
Return yes in this method if all your views have the same size. This will have a big improvement in performance
-
– numberOfSectionsInSMGridView:
Implement this method if your SMGridView has more than 1 section. No need to implement if it only has 1 section
-
– smGridView:sizeForHeaderInSection:
Implement this method if you want to have header views for your section
-
– smGridView:viewForHeaderInSection:
Implement this method if you want to have header views for your section
-
– smGridView:canMoveItemAtIndexPath:
Implement this method in combination with property [SMGridView enableSort] to be able to move items
Instance Methods
numberOfSectionsInSMGridView:
Implement this method if your SMGridView has more than 1 section. No need to implement if it only has 1 section
- (NSInteger)numberOfSectionsInSMGridView:(SMGridView *)gridView
Parameters
- gridView
The calling SMGridView
Return Value
The number of sections in the grid
Declared In
SMGridView.h
smGridView:canMoveItemAtIndexPath:
Implement this method in combination with property [SMGridView enableSort] to be able to move items
- (BOOL)smGridView:(SMGridView *)gridView canMoveItemAtIndexPath:(NSIndexPath *)indexPath
Parameters
- gridView
The calling SMGridView
- indexPath
The indexPath of the item that is about to be dragged
Return Value
YES
if an item at the given indexPath can be moved.
Declared In
SMGridView.h
smGridView:numberOfItemsInSection:
Number of items in a section
- (NSInteger)smGridView:(SMGridView *)gridView numberOfItemsInSection:(NSInteger)section
Return Value
Number of items in a section
Declared In
SMGridView.h
smGridView:numberOfRowsInSection:
Use this method if your sections contain different number of rows. Otherwise you can use numberOfRows property
- (NSInteger)smGridView:(SMGridView *)gridView numberOfRowsInSection:(NSInteger)section
Return Value
number of rows in a section
Declared In
SMGridView.h
smGridView:performRemoveIndexPath:
This method will be called when a remove animation is finished. SMGridViewDataSource
should remove the item at indexPath position in the implementation of this method
- (void)smGridView:(SMGridView *)gridView performRemoveIndexPath:(NSIndexPath *)indexPath
Declared In
SMGridView.h
smGridView:shouldMoveItemFrom:to:
This method will be called when the user sorts the grid. DataSource should update its data accordingly
- (void)smGridView:(SMGridView *)gridView shouldMoveItemFrom:(NSIndexPath *)fromIndexPath to:(NSIndexPath *)toIndexPath
Parameters
- gridView
The calling SMGridView
- fromIndexPath
The original indexPath
- toIndexPath
The new indexPath
Declared In
SMGridView.h
smGridView:sizeForHeaderInSection:
Implement this method if you want to have header views for your section
- (CGSize)smGridView:(SMGridView *)gridView sizeForHeaderInSection:(NSInteger)section
Return Value
The size of the header in the given section. Return CGSizeZero if no header
Declared In
SMGridView.h
smGridView:sizeForIndexPath:
Size of a view in a given indexPath
- (CGSize)smGridView:(SMGridView *)gridView sizeForIndexPath:(NSIndexPath *)indexPath
Return Value
Size of a view in a given indexPath
Declared In
SMGridView.h
smGridView:viewForHeaderInSection:
Implement this method if you want to have header views for your section
- (UIView *)smGridView:(SMGridView *)gridView viewForHeaderInSection:(NSInteger)section
Return Value
The header view for a given section. Return nil if no header.
Declared In
SMGridView.h
smGridView:viewForIndexPath:
You should use dequeReusableView or dequeReusableViewWithClass: inside this method for better performance
- (UIView *)smGridView:(SMGridView *)gridView viewForIndexPath:(NSIndexPath *)indexPath
Return Value
Size of a view in a given indexPath
Declared In
SMGridView.h
smGridView:willQueueView:
This is being called whenever a view is queued. Use this to stop animations, clean…
- (void)smGridView:(SMGridView *)gridView willQueueView:(UIView *)view
Declared In
SMGridView.h
smGridViewSameSize:
Return yes in this method if all your views have the same size. This will have a big improvement in performance
- (BOOL)smGridViewSameSize:(SMGridView *)gridView
Parameters
- gridView
The calling SMGridView
Declared In
SMGridView.h
smGridViewShowLoader:
Use this method to decide wether to show a loader or not. Typically you make your SMGridViewDataSource
manage this method and returning YES
or NO
if it is loading more content.
- (BOOL)smGridViewShowLoader:(SMGridView *)gridView
Parameters
- gridView
The calling SMGridView
Return Value
Wether to show or not the loader
Declared In
SMGridView.h