3

I have a storyboard that was created in Xcode 6 with collection views, and the cells have different size class variations like different font size ... (The collections and the cells created in the storyboard) when I run the app on iOS 9 with Xcode 7 beta 5 the collection views cells shows wrong size class , only after orientation change it shows the right size class. On iOS 8 it works fine. I tried to recreate all the collections and cells from scratch with Xcode 7 , it fixed some of the collections but not all of them , some of them still shows the wrong size class. what else can I do?

Oleg Sherman
  • 2,772
  • 1
  • 21
  • 20
  • I don't know why , maybe it's Voodoo but i had a line of code "myCollection.showsVerticalScrollIndicator = false" , i deleted that line and it fixed the collection. even if I unselect "shows vertical indicator" in the IB it reproduces the problem. – Oleg Sherman Aug 16 '15 at 08:16

2 Answers2

2

I've had the same issue in my project after moving from Xcode 6 to Xcode 7 / iOS 8 to iOS 9. It seems that my UICollectionViewCell is actually the right size. Its contentView however equals the size of the UIStoryBoard.

I've been able to "fix" it by adding this code to my UICollectionViewCell subclass:

- (void)setBounds:(CGRect)bounds {
    [super setBounds:bounds];
    self.contentView.frame = bounds;
}

EDIT: Xcode 7.0.1 fixes this issue.

Florian
  • 226
  • 1
  • 9
-2

I "Use Auto Layout" and disable "Use Size Classes" solved this problem with me

KhoaNN
  • 9
  • 4