Two dimensional scroll using ui collection view
You can include the files to your project from the Resources folder of the library
#import "RTCollectionView.h"
#import "RTDataSource.h"
#import "RTCellDetails.h"
#import "RTColumnHeaderDetails.h"
#import "RTRowHeaderDetails.h"
You can create a two dimmensional scroll using the RTCollection view
data source
collectionViewDataSource = [[RTDataSource alloc] init];
collectionViewDataSource.collectionViewData = [self buildTheDataForTheCollectionView];
// buildTheDataForTheCollectionView should return RTCOLLECTION VIEW DATA object
Collection view declaration
RTCollectionView *collectionView = [[RTCollectionView alloc] initWithFrame:CGRectMake(0,20,self.view.frame.size.width,self.view.frame.size.height - 20)];
collectionView.rtDelegate = self;
collectionView.rtDataSource = collectionViewDataSource;
[self.view addSubview:collectionView];
RTCollectionViewData *data = [[RTCollectionViewData alloc] init];
data.noOfRows = 8; // represents total number of rows.
data.noOfColumns = 5; // represents total number of columns.
data.cellDetailsArray = [self buildCellDetailsAry]; // array of arrays with RTCellDetails
// each index in the array represents the elements of the cells in each row
data.rowHeaderDetailsArray = [self buildrowHeaderDetailsAry]; // array count represents the total number of row headers.
// buildrowHeaderDetailsAry funtion should return array of RTRowHeaderDetails object
data.columnHeaderDetailsArray = [self buildcolumnHeaderDetailsAry];// array count represents the total number of column headers.
// buildcolumnHeaderDetailsAry funtion should return array of RTColumnHeaderDetails object
To notify when the user taps on the cell
- (void)collectionView:(RTCollectionView *)collectionView didSelectItemAtIndex:(struct RTRowColumnIndex)index;
for changing the view for cell or row header or column header change the code for the below methods in RTDataSource
- (RTCollectionViewCell *)collectionView:(RTCollectionView *)collectionView cellForRTRowColumnIndex:(struct RTRowColumnIndex)index
- (RTColumnHeaderCollectionReusableView *)collectionView:(RTCollectionView *)collectionView viewForColumnHeaderAtIndex:(NSInteger)columnIndex
- (RTRowHeaderCollectionReusableView *)collectionView:(RTCollectionView *)collectionView viewForRowHeaderAtIndex:(NSInteger)columnIndex