Skip to content

santhosh1993/RTTwoDimensionalScroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RTTwoDimensionalScroll

Two dimensional scroll using ui collection view

output_csfgsq

Manual

You can include the files to your project from the Resources folder of the library

Importing

#import "RTCollectionView.h"
#import "RTDataSource.h"

#import "RTCellDetails.h"
#import "RTColumnHeaderDetails.h"
#import "RTRowHeaderDetails.h" 

Library Usage

You can create a two dimmensional scroll using the RTCollection view

Initialisation

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];

Variables and its importance

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

Delegate Handler (RTCollectionViewDelegate)

To notify when the user taps on the cell

- (void)collectionView:(RTCollectionView *)collectionView didSelectItemAtIndex:(struct RTRowColumnIndex)index;

UI

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

About

Two dimensional scroll using ui collection view

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published