Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sephiroth87/odmulticolumnlabel

A UILabel replacement that renders text on multiple columns, comes in both Objective-C and Swift versions
https://github.com/sephiroth87/odmulticolumnlabel

Last synced: about 2 months ago
JSON representation

A UILabel replacement that renders text on multiple columns, comes in both Objective-C and Swift versions

Awesome Lists containing this project

README

        

h1. ODMultiColumnLabel

!http://www.orangeinaday.com/img/ODMultiColumnLabel.jpg!

ODMultiColumnLabel is a UILabel replacement that renders text on multiple columns, without any major hassle, available in both Objective-C and Swift

h2. Requirements

Since it's based on TextKit, ODMultiColumnLabel requires iOS 7.0 or greater

h2. Installation

h4. Objective-C

__*Important note if your project doesn't use ARC*: you must add the @-fobjc-arc@ compiler flag to @ODMultiColumnLabel.m@ in Target Settings > Build Phases > Compile Sources.__

* Drag @ODMultiColumnLabel.h@ and @ODMultiColumnLabel.m@ from the @ODMultiColumnLabel@ folder into your project
* @#import "ODMultiColumnLabel.h"@

h4. Swift

* Drag @ODMultiColumnLabel.swift@ from the @ODMultiColumnLabel@ folder into your project

h2. Usage

(see sample Xcode project in @/Demo@)

Create the label as normal, via code or Interface Builder

h3. Customization

The @ODMultiColumnLabel@ can be customized using all normal UILabel properties, using normal or attributed strings, plus the following properties:

h4. Objective-C


@property (nonatomic, assign) NSUInteger numberOfColumns; // default is 1
@property (nonatomic, assign) CGFloat columnsSpacing; // default is 14.0

h4. Swift


var numberOfColumns: UInt = 2
var columnsSpacing: CGFloat = 14.0

h2. Known limitations

* Currently, ODMultiColumnLabel works best if the label has no fixed height, either using Autolayout's intrinsic content size or -sizeToFit. Forcing a smaller height to the label will currently crop the bottom part
* lineBreakMode is currently ignored, partially for the reason above, but also because there seems to be a bug with NSLayoutManager

h2. Credits

ODMultiColumnLabel is brought to you by "Fabio Ritrovato":http://orangeinaday.com and "contributors to the project":https://github.com/Sephiroth87/ODMultiColumnLabel/contributors. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by "creating new issues":https://github.com/Sephiroth87/ODMultiColumnLabel/issues/new. If you're using ODMultiColumnLabel in your project, attribution would be nice.