A UICollectionView bug?

I have a UICollectionViewController while doing the following:

  • Return a string array in collectionView:indexPathForIndexTitle:atIndex:
  • Set cell.contentView.backgroundColor = [UIColor redColor] on collectionView:cellForItemAtIndexPath:

Notice that changing the background color of the cell is just for demonstrating the issue. The important thing is to show index titles on the right.

The result (as following displayed) is that the content view takes the entire collection view width and it doesn't being affected (as it should) by the appearance of the index titles.

With UITableViewController I am doing similar steps:

  • Return a string array in sectionIndexTitlesForTableView:
  • Set cell.contentView.backgroundColor = [UIColor redColor] on tableView:cellForRowAtIndexPath:

Here, in contrast to the collection view behavior, the content view is "shrinking" as expected as following appear:

Can anyone tell if this is a bug or the expected behavior?

You had another question for the collectionView. Was it solved ?

Could you show how you defined the size of cells ? They seem to be full width of the collectionView. What happens if you reduce by 20.

Similarly, what happens if you reduce Collection width by 20 (trailing = 20) ?

Unfortunately not. The issue of my other question is far more problematic and really puzzles me... Can you please help or guide me? I have no idea how to fix it...

You create the collectionView programmatically.

Did you try to create in storyboard (to be sure you configure all parameters as you want) ?

A UICollectionView bug?
 
 
Q