// // CustomCollectionViewCell.m // CGXVerticalMenuView-OC // // Created by CGX on 2018/05/01. // Copyright © 2021 CGX. All rights reserved. // #import "CustomCollectionViewCell.h" @implementation CustomCollectionViewCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initializeViews]; } return self; } - (instancetype)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { [self initializeViews]; } return self; } - (void)initializeViews { self.titleLabel =[[UILabel alloc] init]; self.titleLabel.textColor = [UIColor blackColor]; self.titleLabel.font = [UIFont systemFontOfSize:14]; self.titleLabel.numberOfLines = 0; self.titleLabel.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:self.titleLabel]; self.titleLabel.text = @"我是自定义cell"; } - (void)layoutSubviews { [super layoutSubviews]; self.titleLabel.frame = CGRectMake(0, 0, CGRectGetWidth(self.contentView.frame), CGRectGetHeight(self.contentView.frame)); } @end