澎湃iPad上线版本

TPLabel.m 1.3KB

    // // TPLabel.m // ThePaperDemo // // Created by Scar on 14-9-5. // Copyright (c) 2014年 scar1900. All rights reserved. // #import "TPLabel.h" @interface TPLabel() @property(nonatomic, strong)UIImageView *imageView; @end @implementation TPLabel - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code self.backgroundColor = [UIColor clearColor]; [self addSubview:self.imageView]; [self addSubview:self.titleLabel]; } return self; } - (UIImageView*)imageView { if (!_imageView) { _imageView = [[UIImageView alloc]initWithFrame:CGRectZero]; _imageView.image = Image(@"frontPage/labelBack.png"); _imageView.backgroundColor = [UIColor clearColor]; } return _imageView; } - (UILabel*)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc]initWithFrame:CGRectZero]; _titleLabel.textAlignment = NSTextAlignmentCenter; _titleLabel.textColor = [UIColor colorWithHexString:BLUECOLOR]; _titleLabel.font = [UIFont systemFontOfSize:10]; _titleLabel.backgroundColor = [UIColor clearColor]; } return _titleLabel; } - (void)layoutSubviews { [super layoutSubviews]; self.imageView.frame = self.bounds; self.titleLabel.frame = self.bounds; } @end