#import <UIKit/UIKit.h>
@interface XXNavigationTitleLabel : UILabel
- (id)initWithTitle:(NSString *)navTitle;
@end
#import "XXNavigationTitleLabel.h"
@implementation XXNavigationTitleLabel
- (id)initWithTitle:(NSString *)navTitle
{
self = [self initWithFrame:CGRectZero];
if (self) {
self.text = navTitle;
CGSize s = [self.text sizeWithFont:self.font];
self.frame = CGRectMake(0, 0, s.width, s.height);
self.textAlignment = UITextAlignmentRight;
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.textColor = [UIColor whiteColor];
self.font = [UIFont boldSystemFontOfSize:20];
self.shadowOffset = CGSizeMake(0, 0.5);
self.shadowColor = [UIColor colorWithWhite:0x22/255.0 alpha:1];
}
return self;
}
@end