josshad/EHHorizontalSelectionView

Creating EHHorizontalSelectionView programmatically?

Closed this issue · 2 comments

Hi Danila, I am creating EHHorizontalSelectionView programmatically, means I don't have a storyboard or a XIB in my entire project. I am getting this exception when doing it. Can you help me to sort out what I am doing wrong?

2016-09-14 20:27:39.887 EHHorizontalSelectionViewExample[6606:203316] *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.60.7/UICollectionView.m:3994

2016-09-14 20:27:39.892 EHHorizontalSelectionViewExample[6606:203316] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier EHHorizontalLineViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

This is what I am doing:

hSelView4 = [[EHHorizontalSelectionView alloc] init];
hSelView4.frame = CGRectMake(0, 400.0f, 320.0, 60.0f);
hSelView4.delegate = self;
[self.view addSubview:hSelView4];

[hSelView4 registerCellWithClass:[EHRoundedHorizontalViewCell class]];

I have also implemented it's datasource methods.

Hello!

Fix that issue in 1.0.1

Problem was in duplicating call of "startView" method

@josshad , thanks! 👍