Re: Mixed font sizes in a UILabel?
Re: Mixed font sizes in a UILabel?
- Subject: Re: Mixed font sizes in a UILabel?
- From: Jon Drukman <email@hidden>
- Date: Thu, 15 Oct 2009 10:10:09 -0700
On Thu, Oct 15, 2009 at 9:20 AM, Eric E. Dolecki <email@hidden> wrote:
> Thanks Luke. This might be a nice feature request to be able to do this
> easily (and let's say truncation and resizing would not work if implemented
> (I realize the pitfalls)).
>
You might want to check out Joe Hewitt (of Facebook fame)'s library:
Three20.
http://github.com/joehewitt/three20
It supports styled text labels with css among many other features.
NSString* kText = @"\
This is a test of styled labels. Styled labels support \
<b>bold text</b>, <i>italic text</i>, <span class=\"blueText\">colored
text</span>, \
<span class=\"largeText\">font sizes</span>, \
<span class=\"blueBox\">spans with backgrounds</span>, inline images \
<img src=\"bundle://smiley.png\"/>, and <a
href=\"http://www.google.com\">hyperlinks</a>
you can \
actually touch. URLs are automatically converted into links, like this:
http://www.foo.com\
<div>You can enclose blocks within an HTML div.</div>\
Both line break characters\n\nand HTML line breaks<br/>are respected.";
TTStyledTextLabel* label1 = [[[TTStyledTextLabel alloc]
initWithFrame:self.view.bounds] autorelease];
label1.font = [UIFont systemFontOfSize:17];
label1.text = [TTStyledText textFromXHTML:kText lineBreaks:YES URLs:YES];
label1.contentInset = UIEdgeInsetsMake(10, 10, 10, 10);
[label1 sizeToFit];
[self.view addSubview:label1];
-jsd-
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden