From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.m | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 116 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.m b/screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.m new file mode 100755 index 0000000..83f8ee0 --- /dev/null +++ b/screendisplay/Pods/SDCycleScrollView/SDCycleScrollView/Lib/SDCycleScrollView/SDCollectionViewCell.m @@ -0,0 +1,116 @@ +// +// SDCollectionViewCell.m +// SDCycleScrollView +// +// Created by aier on 15-3-22. +// Copyright (c) 2015��� GSD. All rights reserved. +// + + +/* + + ********************************************************************************* + * + * ������������ ������SDCycleScrollView������QQ������185534916 ������������ + * + * ������������������������������������������������������bug������������������������������������������������������������������������bug��� + * ��������������������� + * ������������:GSD_iOS + * Email : gsdios@126.com + * GitHub: https://github.com/gsdios + * + * ���������������������������SDAutoLayout������ + * ���������������������������������������Cell���Tableview������������������Label���ScrollView��������������������������� + * ���������������������AutoLayout������ + * ���������������http://www.letv.com/ptv/vplay/24038772.html + * ���������������https://github.com/gsdios/SDAutoLayout/blob/master/README.md + * GitHub���https://github.com/gsdios/SDAutoLayout + ********************************************************************************* + + */ + + +#import "SDCollectionViewCell.h" +#import "UIView+SDExtension.h" + +@implementation SDCollectionViewCell +{ + __weak UILabel *_titleLabel; +} + + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + [self setupImageView]; + [self setupTitleLabel]; + } + + return self; +} + +- (void)setTitleLabelBackgroundColor:(UIColor *)titleLabelBackgroundColor +{ + _titleLabelBackgroundColor = titleLabelBackgroundColor; + _titleLabel.backgroundColor = titleLabelBackgroundColor; +} + +- (void)setTitleLabelTextColor:(UIColor *)titleLabelTextColor +{ + _titleLabelTextColor = titleLabelTextColor; + _titleLabel.textColor = titleLabelTextColor; +} + +- (void)setTitleLabelTextFont:(UIFont *)titleLabelTextFont +{ + _titleLabelTextFont = titleLabelTextFont; + _titleLabel.font = titleLabelTextFont; +} + +- (void)setupImageView +{ + UIImageView *imageView = [[UIImageView alloc] init]; + _imageView = imageView; + [self.contentView addSubview:imageView]; +} + +- (void)setupTitleLabel +{ + UILabel *titleLabel = [[UILabel alloc] init]; + _titleLabel = titleLabel; + _titleLabel.hidden = YES; + [self.contentView addSubview:titleLabel]; +} + +- (void)setTitle:(NSString *)title +{ + _title = [title copy]; + _titleLabel.text = [NSString stringWithFormat:@" %@", title]; + if (_titleLabel.hidden) { + _titleLabel.hidden = NO; + } +} + +-(void)setTitleLabelTextAlignment:(NSTextAlignment)titleLabelTextAlignment +{ + _titleLabelTextAlignment = titleLabelTextAlignment; + _titleLabel.textAlignment = titleLabelTextAlignment; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + + if (self.onlyDisplayText) { + _titleLabel.frame = self.bounds; + } else { + _imageView.frame = self.bounds; + CGFloat titleLabelW = self.sd_width; + CGFloat titleLabelH = _titleLabelHeight; + CGFloat titleLabelX = 0; + CGFloat titleLabelY = self.sd_height - titleLabelH; + _titleLabel.frame = CGRectMake(titleLabelX, titleLabelY, titleLabelW, titleLabelH); + } +} + +@end -- Gitblit v1.8.0