herzbube / littlego

Little Go. An iOS application that lets you play the game of Go on the iPhone or iPad.
https://littlego.herzbube.ch/
Apache License 2.0
140 stars 54 forks source link

Current board position background color not set when navigating to first/last position #326

Open herzbube opened 5 years ago

herzbube commented 5 years ago

On iPhone 6/6s/7/8 Plus as well as on iPhone XS Max, when the user navigates to the first or last board position most of the time the new current board position is not displayed with a special background color as it should.

herzbube commented 5 years ago

Debugging shows that the problem occurs in the BoardPositionCollectionViewController method selectItemAtIndexPath:, when that method invokes the UICollectionView method selectItemAtIndexPath:animated:scrollPosition:() method.

The expected behaviour is that invoking this method sets the UICollectionViewCell object's selected property to YES. This in turn would cause the cell to be displayed with the background color that is configured in BoardPositionCollectionViewCell on this line:

self.selectedBackgroundView.backgroundColor = currentBoardPositionCellBackgroundColor;

What actually happens, though, is that the UICollectionViewCell object's selected property remains set to NO. Because of that the cell is not rendered with the desired background color.

herzbube commented 5 years ago

Further testing shows that the problem disappears when the app is launched in the iPhone 6 Plus simulator running iOS 9.3 or iOS 8.4. The problem seems somehow to be tied to iOS versions 10 and newer.

So far neither a solution nor a workaround could be found. A workaround would consist of forcing the selected property to become YES in some non-standard manner.

herzbube commented 5 years ago

As this is not a critical bug and affects only some but not all devices, version 1.4 will be released with this issue unresolved.

Cf. this StackOverflow question.

Future investigation should probably start with an attempt to repro this in a minimal project. If unsuccessful, the mini-project can then be expanded step by step until the repro has been achieved.