Skip to content
custom label allows you to specify line height and text anchoring
Objective-C
Find file
Latest commit 5b5db92 Nov 14, 2014 Josh Wu Merge pull request #24 from viki-org/lemoncake-master
Lemoncake master
Failed to load latest commit information.
MSLabelExample
.gitignore add .gitignore Oct 31, 2014
MIT-LICENSE including license Jun 23, 2012
MSLabel.h Fixing header file align/alignment naming Aug 8, 2012
MSLabel.m fix compile warnings Oct 31, 2014
README.md make Readme markdown Oct 27, 2012

README.md

MSLabel is a custom UILabel that allows you to specify LineHeight and Anchor point. There is another custom UILabel that supports line heights here: https://github.com/Tuszy/MTLabel It works great, except it uses coreText so it won't work on iOS < v3.2 MSLabel doesn't use coreText and simply overrides drawRect.

Usage

It supports most UILabel properties including text alignment, font, colors...etc.

line height specifies the number of pixels between draw points of each line. anchorToBottom specifies whether the text grows from the top of the frame or the bottom.

eg. MSLabel *titleLabel = [[[MSLabel alloc] initWithFrame:CGRectMake(0, 0, 100, 50)] autorelease]; titleLabel.lineHeight = 13; titleLabel.anchorToBottom = YES; titleLabel.numberOfLines = 2; titleLabel.text = @"Some really really long text that goes to the second line"; [self.view addSubview:titleLabel];

Unsupported

  • \n line breaks are ignored
  • Does not support UILineBreakModes. By default MSLabel truncates the last line with ...
Something went wrong with that request. Please try again.