// // HXTagCollectionViewCell.m // 黄轩 https://github.com/huangxuan518 // // Created by 黄轩 on 16/1/13. // Copyright © 2015年 IT小子. All rights reserved. // #import "HXTagCollectionViewCell.h" @implementation HXTagCollectionViewCell - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { _titleLabel = [[UILabel alloc] initWithFrame:self.bounds]; _titleLabel.textAlignment = NSTextAlignmentCenter; _image = [[UIImageView alloc] init]; _image.contentMode = UIViewContentModeScaleAspectFill; _image.layer.masksToBounds = YES; [self.contentView addSubview:_image]; [self.contentView addSubview:_titleLabel]; } return self; } - (void)layoutSubviews { [super layoutSubviews]; self.image.frame = self.bounds; self.titleLabel.frame = self.bounds; } - (void)prepareForReuse { [super prepareForReuse]; self.titleLabel.text = @""; } @end