Giter VIP home page Giter VIP logo

mtlabel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mtlabel's Issues

Readme not accurate about UILabel

"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 :)

Vertical Alignment

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 customize line spacing

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.

Please add semantic version tags

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

How to get the label height after ResizeToFitText?

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.

How to get the text height?

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;
}

setResizeToFitText does not work

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];

limitToNumberOfLines issue

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;

    }

ld linker error

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?

Compatibility with Arabic language

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....

  • Arabic text direction is right to left - MTLabel needs to be adjusted in a way that the alignment is set correct => right side.
  • Modifying the line height bears one problem, one cannot calculate the dimension of the text with NSString sizeWithFont anymore. It would be perfect if MTLabel could provide an own sizeWithFont feature that considers the modified line height

Thank you very much for your efforts,
Bilal

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.