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

Watchers

ODFoundation avatar

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.