GithubHelp home page GithubHelp logo

mtlabel's Introduction

Hi there I'm Mike๐Ÿ”ด ๐Ÿ‘‹

I'm a developer who specialises in native mobile apps for iOS and Android (in that order) which live on the intersection of physical and digital worlds. I work at Intent where I manage one of the mobile engineering teams.

Tools I use during work

iOS ๐Ÿ“ฑ Android ๐Ÿค– IoT ๐Ÿฆพ
Swift Kotlin Arduino
SwiftUI Jetpack Compose Raspberry Pi
CoreBluetooth Android Auto Espressif
CarPlay BlueZ

I'm also one of those dinasours who worked with Objective-C and UIKit and XML-based Android views.

Some of the stuff I created:

  • MTLabel Back in the day, UILabel was pretty limited so I rewrote it with some fireworks
  • Base64Stream You have a large base64 encoded file? Convert it to a stream instead!
  • AndroidAr I used to do some AR stuff on Android a while back before ARCore. I shared some of the code I used to make future devs life a little easier.

Hackatons

I love taking part in Hackatons. I also managed to win some of them. I'm also a cohost of a podcast which is entirely focused for hackatons: The HackathonShow. Quite recently, I've won HackYeah 2023 cybersecurity task Screenshot 2024-03-14 at 11 58 37

I occasionally speak at conferences such as:

mtlabel's People

Contributors

hwaxxer avatar marcins avatar srgtuszy avatar

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

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

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.

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.

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?

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

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

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.

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

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.