srgtuszy / mtlabel Goto Github PK
View Code? Open in Web Editor NEWA lightweight replacement for Apple's UILabel
Home Page: http://tuszy.github.com
A lightweight replacement for Apple's UILabel
Home Page: http://tuszy.github.com
"UILabel forces you to specify number of lines"
This is not true (anymore?)
Setting the line number to 0 will allow unlimited number of lines.
Great project anyway :)
There seems to be no way to vertically align a label. For example, if you declare a 2 line label, but the label only turns out to be 1 line, I would need it to be vertically centered instead of align-top.
How to change link's color.
Love the library. The one feature I am looking for however is how to customize the line spacing between label lines.
Does that feature exist with this library?
I couldn't find it in the API.
i.e. I would like to sent the spacing between lines on a label to 4px.
How would I do that?
Many thx.
I’ve recently added MTLabel to the CocoaPods package manager repo.
CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, MTLabel doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags
Hi guys,
here is my code
MTLabel *label3 = [MTLabel labelWithFrame:CGRectMake(20, 240, 250, 1)
andText:@"This label was resized to fit text inside it"];
[label3 setTextAlignment:MTLabelTextAlignmentCenter];
[label3 setFont:[UIFont systemFontOfSize:20]];
[label3 setResizeToFitText:YES];
NSLog(@"%f", label3.frame.size.height);
[self.view addSubview:label3];
I want to get the label frame size , but the value of NSLog output is always 1.000000
How i get the label frame size after resize ?
Thanks guys.
I have a bunch of UILabels in a scrollview. I just replaced them with these, how do i get the height of the text?
This works for normal labels:
static CGFloat getLabelHeight(MTLabel *label, CGFloat width)
{
CGSize size = [[label text] sizeWithFont: [label font]
constrainedToSize: CGSizeMake(width,CGFLOAT_MAX)
lineBreakMode: UILineBreakModeWordWrap];
return size.height;
}
Hi guys!
I can't make setResizeToFitText work.
I'm pasting in the code from the documentation, and that does not seem to work either.
What am I doing wrong?
Thanks,
Gon
MTLabel *label = [MTLabel labelWithFrame:CGRectMake(20, 150, 250, 70)
andText:@"Hello!"];
[label setTextAlignment:MTLabelTextAlignmentCenter];
[label setFont:[UIFont boldSystemFontOfSize:15]];
[label setFontColor:[UIColor blueColor]];
[label setLineHeight:20];
[label setResizeToFitText:YES];
[self.view addSubview:label];
Interesting issue. If I use any of the standard colors (ie [UIColor blackColor]) I get crisp, good looking text. However, using an RGB color (ie [UIColor colorWithRed:49/255.0f green:54/255.0f blue:57/255.0f alpha:1]) causes blurry text:
Just replace the code at line 417---422 in MTLabel.m file with following code
//Check to see if our index didn't exceed the text, and if should limit to number of lines
if ((currentIndex + lineLength >= [_text length]) ||
(_limitToNumberOfLines && count >= _numberOfLines-1)) {
shouldDrawAlong = NO;
}
I'm working on a project that already uses CoreText and I'm getting a nasty ld linker error in Xcode 4 when I add the header and implementation files. They look like this:
ld: duplicate symbol _CTLineGetTypographicBoundsAsRect in /Users/dylan/Library/Developer/Xcode/DerivedData/unstuck-aqkbmvbxmfrwxcflssycdwtilkfl/Build/Intermediates/unstuck.build/Debug-iphonesimulator/unstuck.build/Objects-normal/i386/MTLabel.o and /Users/dylan/Library/Developer/Xcode/DerivedData/unstuck-aqkbmvbxmfrwxcflssycdwtilkfl/Build/Intermediates/unstuck.build/Debug-iphonesimulator/unstuck.build/Objects-normal/i386/OHAttributedLabel.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
Any thoughts?
UIKit uses textColor
and not fontColor
. I guess it makes sense to stick with known naming conventions.
Hi.
Your MTLabel is perfect for me, because I can adjust the line height with it.
Arabic (especially when used to write poetry or religious texts) has little symbols which modify the pronunciation, these little symbols are a main part of the written language!
The arabic fonts require a larger height of lines, because these symbols are placed above and underneath the text.
But there are two problems that come along with these facts....
Thank you very much for your efforts,
Bilal
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.