Alex
Alex

Reputation: 511

UICollection View ios 7 issues

i am using this Code for my UIcollectionView , its working fine in iOS6 but with ios7 and its not working , as once i start scrolling the CollectionView the entire elements Orientation messed up. Any idea to this

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.filteredNewsItems.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
NewsItemCell *cell = (NewsItemCell *)[collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
cell.autoresizingMask = UIViewAutoresizingNone;

[cell loadWithArticle:self.filteredNewsItems[indexPath.item]];

return cell;
}

enter image description here

Upvotes: 1

Views: 964

Answers (2)

masty
masty

Reputation: 1589

I suspect your loadWithArticle: method is always adding views to the NewsItemCell rather than reusing any existing subviews that you created the first time the cell was populated. Can you provide the code for loadWithArticle:?

Upvotes: 0

Anurag Soni
Anurag Soni

Reputation: 1087

try to use

 static NSString *cellIdenfier = @"collectionCell"; // this can be any string
NewsItemCell *cell = (NewsItemCell *)[collectionView dequeueReusableCellWithReuseIdentifier:cellIdenfier forIndexPath:indexPath];

your cell got messed up because while scrolling cell is re used so as in your case providing static cell identifier can fix your problem. if problem still persist with you then let me know

Upvotes: 1

Related Questions