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.
SMGridViewDataSourceshould 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
SMGridViewDataSourcemanage this method and returningYESorNOif 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 *)gridViewParameters
- gridView
The calling SMGridView
Return Value
The number of sections in the grid
Declared In
SMGridView.hsmGridView:canMoveItemAtIndexPath:
Implement this method in combination with property [SMGridView enableSort] to be able to move items
- (BOOL)smGridView:(SMGridView *)gridView canMoveItemAtIndexPath:(NSIndexPath *)indexPathParameters
- 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.hsmGridView:numberOfItemsInSection:
Number of items in a section
- (NSInteger)smGridView:(SMGridView *)gridView numberOfItemsInSection:(NSInteger)sectionReturn Value
Number of items in a section
Declared In
SMGridView.hsmGridView:numberOfRowsInSection:
Use this method if your sections contain different number of rows. Otherwise you can use numberOfRows property
- (NSInteger)smGridView:(SMGridView *)gridView numberOfRowsInSection:(NSInteger)sectionReturn Value
number of rows in a section
Declared In
SMGridView.hsmGridView: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 *)indexPathDeclared In
SMGridView.hsmGridView: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 *)toIndexPathParameters
- gridView
The calling SMGridView
- fromIndexPath
The original indexPath
- toIndexPath
The new indexPath
Declared In
SMGridView.hsmGridView:sizeForHeaderInSection:
Implement this method if you want to have header views for your section
- (CGSize)smGridView:(SMGridView *)gridView sizeForHeaderInSection:(NSInteger)sectionReturn Value
The size of the header in the given section. Return CGSizeZero if no header
Declared In
SMGridView.hsmGridView:sizeForIndexPath:
Size of a view in a given indexPath
- (CGSize)smGridView:(SMGridView *)gridView sizeForIndexPath:(NSIndexPath *)indexPathReturn Value
Size of a view in a given indexPath
Declared In
SMGridView.hsmGridView:viewForHeaderInSection:
Implement this method if you want to have header views for your section
- (UIView *)smGridView:(SMGridView *)gridView viewForHeaderInSection:(NSInteger)sectionReturn Value
The header view for a given section. Return nil if no header.
Declared In
SMGridView.hsmGridView:viewForIndexPath:
You should use dequeReusableView or dequeReusableViewWithClass: inside this method for better performance
- (UIView *)smGridView:(SMGridView *)gridView viewForIndexPath:(NSIndexPath *)indexPathReturn Value
Size of a view in a given indexPath
Declared In
SMGridView.hsmGridView:willQueueView:
This is being called whenever a view is queued. Use this to stop animations, clean…
- (void)smGridView:(SMGridView *)gridView willQueueView:(UIView *)viewDeclared In
SMGridView.hsmGridViewSameSize:
Return yes in this method if all your views have the same size. This will have a big improvement in performance
- (BOOL)smGridViewSameSize:(SMGridView *)gridViewParameters
- gridView
The calling SMGridView
Declared In
SMGridView.hsmGridViewShowLoader:
Use this method to decide wether to show a loader or not. Typically you make your SMGridViewDataSource manage this method and returning YESor NO if it is loading more content.
- (BOOL)smGridViewShowLoader:(SMGridView *)gridViewParameters
- gridView
The calling SMGridView
Return Value
Wether to show or not the loader
Declared In
SMGridView.h