1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //
- // PPCollectionViewCell.m
- // PPImageScrollingTableViewControllerDemo
- //
- // Created by popochess on 13/8/10.
- // Copyright (c) 2013年 popochess. All rights reserved.
- //
- #import "PPCollectionViewCell.h"
- @interface PPCollectionViewCell ()
- @property (strong, nonatomic) UIImageView *imageView;
- @property (strong, nonatomic) UITextView *imageTitle;
- @end
- @implementation PPCollectionViewCell
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- // Initialization code
- self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0., 0., frame.size.width, frame.size.height)];
- }
- return self;
- }
- -(void)setImage:(UIImage *)image
- {
- self.imageView.image = image;
- }
- - (void)setImageTitleLabelWitdh:(CGFloat)width withHeight:(CGFloat)height
- {
- self.imageTitle = [[UITextView alloc] initWithFrame:CGRectMake(0., _imageView.frame.size.height/2+5, width,height)];
- self.imageTitle.contentInset = UIEdgeInsetsMake(1,1,1,1);
- self.imageTitle.userInteractionEnabled = NO;
- }
- - (void)setImageTitleTextColor:(UIColor*)textColor withBackgroundColor:(UIColor*)bgColor
- {
- self.imageTitle.textColor = textColor;
- self.imageTitle.backgroundColor = bgColor;
- }
- - (void)setTitle:(NSString*)title ;
- {
- if ([self.contentView subviews]){
- for (UILabel *subview in [self.contentView subviews]) {
- [subview removeFromSuperview];
- }
- }
- [self.contentView addSubview:self.imageView];
- self.imageTitle.text = title;
- [self.contentView addSubview:self.imageTitle];
-
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect
- {
- // Drawing code
- }
- */
- @end
|