How to enlarge dynamically an UILabel (label and font size)?
Posted
by Flocked
on Stack Overflow
See other posts from Stack Overflow
or by Flocked
Published on 2010-03-23T01:40:54Z
Indexed on
2010/03/23
1:51 UTC
Read the original article
Hit count: 571
Hello, Im currently working on an iPhone project. I want to enlarge dynamically an UILabel in Objective-C like this:
How is this possible? I thought I have to do it with CoreAnimation, but I didn't worked. Here is the code I tried:
UILabel * fooL = //[…]
fooL.frame = CGRectMake(fooL.frame.origin.x, fooL.frame.origin.y, fooL.frame.size.width, fooL.frame.size.height);
fooL.font = [UIFont fontWithName:@"Helvetica" size:80];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:0.5];
[UIView setAnimationBeginsFromCurrentState:YES];
fooL.font = [UIFont fontWithName:@"Helvetica" size:144]; //bigger size
fooL.frame = CGRectMake(20 , 44, 728, 167); //bigger frame
[UIView commitAnimations];
The problem with this code is that it doesn't change the fontsize dynamically.
© Stack Overflow or respective owner