Search This Blog

Wednesday, 22 August 2012

Zoom Effect for UILabel in xcode

Hello Friends,
                       Here is another one a zoomEffect like the one you see in slide show , simple yet useful follow the code:

Code:

In your viewController.h :


#import <UIKit/UIKit.h>

@interface ViewController : UIViewController{
    IBOutlet UILabel *label;
}
@property(retain,nonatomic)IBOutlet UILabel *label;
-(void)zoomer;
@end


In viewController.m :


NSInteger i=0;
double fontsize;

- (void)viewDidLoad
{
    [super viewDidLoad];
    fontsize = 0;
// Do any additional setup after loading the view, typically from a nib.
    [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(zoomer) userInfo:self repeats:YES];
    label.font = [UIFont fontWithName:@"Arial" size:fontsize];
    
}


-(void)zoomer{
    if(i==0){
    if(fontsize<=200.0){
        if(fontsize==200.0){
            i++;
        }
    label.font = [UIFont fontWithName:@"Arial" size:fontsize];
    fontsize++;
    }
}
    
}



I assume you know how to make connections between Storyboard elements and IBOutlets:

ask for any queries:

No comments:

Post a Comment