IOS Make Lable link class
//
// UIBlinkLabel.h
#import <Foundation/Foundation.h>
@interface UIBlinkLabel : UILabel {
@private
NSTimer *timer;
NSTimeInterval blinkInterval;
}
-(id)initWithFrame:(CGRect)frame blinkFor:(NSTimeInterval) blInterval;
-(void)timerTick: (id)sender;
@end
//
// UIBlinkLabel.m
#import "UIBlinkLabel.h"
@implementation UIBlinkLabel
-(id)initWithFrame:(CGRect)frame blinkFor:(NSTimeInterval)blInterval
{
self = [super initWithFrame:frame];
if (self) {
blinkInterval = blInterval;
timer = [NSTimer scheduledTimerWithTimeInterval:blinkInterval target:self selector:@selector(timerTick:) userInfo:nil repeats:YES];
}
return self;
}
-(void)timerTick:(id) sender
{
self.hidden = !self.hidden;
}
-(void)dealloc
{
[super dealloc];
}
@end
// UIBlinkLabel.h
#import <Foundation/Foundation.h>
@interface UIBlinkLabel : UILabel {
@private
NSTimer *timer;
NSTimeInterval blinkInterval;
}
-(id)initWithFrame:(CGRect)frame blinkFor:(NSTimeInterval) blInterval;
-(void)timerTick: (id)sender;
@end
//
// UIBlinkLabel.m
#import "UIBlinkLabel.h"
@implementation UIBlinkLabel
-(id)initWithFrame:(CGRect)frame blinkFor:(NSTimeInterval)blInterval
{
self = [super initWithFrame:frame];
if (self) {
blinkInterval = blInterval;
timer = [NSTimer scheduledTimerWithTimeInterval:blinkInterval target:self selector:@selector(timerTick:) userInfo:nil repeats:YES];
}
return self;
}
-(void)timerTick:(id) sender
{
self.hidden = !self.hidden;
}
-(void)dealloc
{
[super dealloc];
}
@end
Comments
Post a Comment