Coder Social home page Coder Social logo

tharrayview's Introduction

THArrayView

alt tag

THArrayView is a UIView subclass that draw arrays. It has been developed to be used like a UITableView, with a datasource and a delegate protocol.

You can create a THArrayView programmatically :

	THArrayView *arrayView = [[THArrayView alloc] initWithFrame:self.view.frame];
	arrayView.delegate = self;
	arrayView.dataSource = self;
	[self.view addSubview:arrayView];

Or from Xib and Storyboard :

  • Create a UIView,
  • Set its class to THArrayView
  • Set its datasource and delegate with Ctrl + drag,

Content

There are two important methods you have to implement from THArrayViewDelegate because they set the number of rows & columns :

	- (NSInteger)numberOfRowsInArrayView:(THArrayView *)arrayView;
	- (NSInteger)numberOfColumnsInArrayView:(THArrayView *)arrayView;

You also have to implement one of these to set the content of your arrayView :

	// Content as NSString
	- (NSString *)arrayView:(THArrayView *)arrayView stringForCellAtIndexPath:(NSIndexPath *)indexPath;
	// Content as NSAttributedString
	- (NSAttributedString *)arrayView:(THArrayView *)arrayView attributedStringForCellAtIndexPath:(NSIndexPath *)indexPath;

Appearance

You can set general appearance by setting your THArrayView:

	@property (nonatomic) CGColorRef cellBorderColor;
	@property (nonatomic) CGFloat cellBorderWidth;
	@property (nonatomic) UIBaselineAdjustment cellBaselineAdjustment;
	@property (nonatomic) NSLineBreakMode cellLineBreakMode;

Or via its datasource :

	- (CGFloat)arrayView:(THArrayView *)arrayView widthForColumn:(NSInteger)column;
	- (CGFloat)arrayView:(THArrayView *)arrayView heightForRow:(NSInteger)row;
	- (UIEdgeInsets)arrayView:(THArrayView *)arrayView marginForCellAtIndexPath:(NSIndexPath *)indexPath;
	- (UIColor *)arrayView:(THArrayView *)arrayView backgroundColorForCellAtIndexPath:(NSIndexPath *)indexPath;
	- (UIFont *)arrayView:(THArrayView *)arrayView fontForCellAtIndexPath:(NSIndexPath *)indexPath;
	- (UIColor *)arrayView:(THArrayView *)arrayView fontColorForCellAtIndexPath:(NSIndexPath *)indexPath;
	- (NSTextAlignment)arrayView:(THArrayView *)arrayView textAlignmentForCellAtIndexPath:(NSIndexPath *)indexPath;

tharrayview's People

Stargazers

 avatar Vishwas NG avatar wsliang avatar Xiaobo Deng avatar Jurģis Ķiršakmens avatar 张群 avatar Simo Elalj avatar Kevin Nguy avatar İsmail avatar azu avatar Bowen avatar Felipe F Garcia avatar  avatar  avatar  avatar Samuel Giddins avatar Cameron Roth avatar  avatar  avatar Donald Pinckney avatar

Watchers

mayulu avatar John avatar Aaaaaaaaaah. avatar Tanguy Helesbeux avatar Nik Orfanos avatar

tharrayview's Issues

Scrolling Enhancement......

Your tool is fantastic!
Thanks a lot for that!!!
I would like to propose an enhancement...if you can of course
if my grid goes beyond the view make it to be able to scroll

Thanks again

George Gerardis

Example.....

Hello, Thank you for your lovely Tool!
I try to have attributed string in cell as you propose....nut I can not change color of the font.
Can you provide with an example with attributed string cell?

Thanks again..
George Gerardis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.