ypasswordiphone/YShadowLabel.m

52 lines
1.1 KiB
Mathematica
Raw Permalink Normal View History

2010-09-26 07:22:36 +00:00
//
// YShadowLabel.m
// YPassword
//
// Created by Yann Esposito on 26/09/10.
// Copyright 2010 yannesposito. All rights reserved.
//
#import "YShadowLabel.h"
@implementation YShadowLabel
2010-09-26 18:09:32 +00:00
@synthesize blurRadius;
2010-09-26 07:22:36 +00:00
- (id)initWithFrame:(CGRect)frame {
2010-09-26 18:09:32 +00:00
if ((self = [super initWithFrame:frame])) {
2010-09-26 07:22:36 +00:00
// Initialization code
2010-09-26 18:09:32 +00:00
self.blurRadius = [NSNumber numberWithFloat:5.0];
2010-09-26 07:22:36 +00:00
}
return self;
}
2010-09-26 18:09:32 +00:00
- (void)awakeFromNib {
// Initialization code
self.blurRadius = [NSNumber numberWithFloat:5.0];
}
2010-09-26 07:22:36 +00:00
- (void) drawTextInRect:(CGRect)rect {
CGContextRef myContext = UIGraphicsGetCurrentContext();
CGContextSaveGState(myContext);
2010-09-26 18:09:32 +00:00
CGContextSetShadow (myContext, self.shadowOffset, 1);
2010-09-26 07:22:36 +00:00
CGColorSpaceRef myColorSpace = CGColorSpaceCreateDeviceRGB();
2010-09-26 18:09:32 +00:00
CGColorRef myColor = [self.shadowColor CGColor];
CGContextSetShadowWithColor (myContext, self.shadowOffset, (CGFloat)[self.blurRadius floatValue], myColor);
2010-09-26 07:22:36 +00:00
[super drawTextInRect:rect];
CGColorSpaceRelease(myColorSpace);
CGContextRestoreGState(myContext);
}
- (void)dealloc {
[super dealloc];
}
@end