lemoncake / mslabel Goto Github PK
View Code? Open in Web Editor NEWcustom label allows you to specify line height and text anchoring
License: MIT License
custom label allows you to specify line height and text anchoring
License: MIT License
The drawing ignores any shadow settings applied to the UILabel. This can easily be fixed by inserting the following after line 33 in MSLabel.m:
CGContextSetShadowWithColor(UIGraphicsGetCurrentContext(), self.shadowOffset, 0, self.shadowColor.CGColor);
I'm trying to figure out how to bring back the middle vertical alignement from the standard UILabel. Any idea how to start ?
Thanks,
If all you want is a label with the ability to change the line spacing there is very little to choose from on github. The example you mentioned, MTLabel, says there's a known issue in drawing in table cell due to the fact he uses performSelector:withObject:afterDelay:. Any code using this method instantly rings alarm bells in my head.
Anyway your solution seemed ideally as although it only supports one lineBreakMode it was the one I needed but alias your text wrapping code gets stuck in an infinite loop and after inspection I can see if needs some serious optimisation.
Hope you get the time to fix it as this is useful little class
In the standard UILabel, a newline character \n causes a line break. In this component, the newline characters gets trimmed out and are not respected.
Hello,
I am implementing MSLabel Class for line spacing in vertical formate label but its not working in iOS 8 Xcode 6.1 with Autolayout. please check. Help much Appreciate...
Thanks,
NSArray *splitString = [string componentsSeparatedByString:@" "];
NSMutableArray *allLines = [NSMutableArray array];
NSMutableString *line = [NSMutableString string];
for (int i = 0; i < splitString.count; i++) {
NSString *word = [splitString objectAtIndex:i];
NSString *fakeLine = [NSString stringWithFormat:@"%@%@ ",line, word];
CGSize lineSize = [fakeLine sizeWithFont:self.font];
if (lineSize.width <= self.frame.size.width) {
[line appendFormat:@"%@ ", word];
} else {
[allLines addObject:[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
line = [NSMutableString string];
[line appendFormat:@"%@ ", word];
}
}
[allLines addObject:[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
its only one loop and you don't need a set to "Remove words" you just need to know where your at. Its probably faster, plus the other one with the weird double loop was giving me an EXC_BAD_ACCESS when I used that same method to create a inner shadow rendering engine.
Podspec for cocoa pods is pointing to an old commit, please update!
What license is this distributed under? Thanks!
Nice subclass. Calling sizeToFit though produces unexpected results.
Sometimes when I'm using 'NSLineBreakByWordWrapping' and having more than 1 line text (2 or more) and using 'lineHeight' property, there is no space between some words. Also, I only came across this in 'Hebrew' text UTF8 from right to left, so maybe there is the problem. Why is that?
There are certain warnings related to properties deprecated in IOS6. and rather we should use functions that are given for IOS6 ex. for breaklinemode OR textalignment.
If possible pls, update it so that it supports and goes well with IOS 6.
Sumit
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.