UICollectionView add decoration View/

Finally, I did not use decoration view but combine image view and title label into CollectionView. Following images are demo.

In CVContactPickerImageCollectionWithNameCell.h, I add two properties as: collectionImageView and displayName.


 @interface CVContactPickerImageCollectionWithNameCell : UICollectionViewCell
@property (nonatomic, assign) id delegate;
 @property (nonatomic, retain) CVUserImageView *collectionImageView;
 @property (nonatomic, retain) UILabel *displayName;
@end

And due to the name could not show up fully. Then I use lineBreakMode and numberOfLines in UILabel.


 #import "CVContactPickerImageCollectionWithNameCell.h"
@implementation CVContactPickerImageCollectionWithNameCell
- (id)initWithFrame:(CGRect)frame
 {
 self = [super initWithFrame:frame];
if (self) {
 _collectionImageView = [[CVUserImageView alloc] initWithFrame:CGRectMake(15,0,45,45)];
 [self.contentView addSubview:_collectionImageView];
_displayName = [[UILabel alloc] initWithFrame:CGRectMake(5,45,60,30)];
 _displayName.font = [UIFont systemFontOfSize:12];
 _displayName.textAlignment = NSTextAlignmentCenter;
 _displayName.lineBreakMode = NSLineBreakByWordWrapping;
 _displayName.numberOfLines = 2;
 [self.contentView addSubview:_displayName];
 }
 return self;
 }

To section is based on UICollectionView.

Screen Shot 2013-11-05 at 4.55.28 PM

Screen Shot 2013-11-05 at 4.54.37 PM

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s