FlexMonkey / SnapSwift

SnapSeed Style Popup Menu for iOS
87 stars 9 forks source link

NSInternalInconsistencyException when scrolling through lists #1

Closed FlexMonkey closed 9 years ago

FlexMonkey commented 9 years ago

SnapSwift now supports selecting from a list of string values. This is implemented by simply populating the stringValues parameter in a SnapSwiftParameter:

let presetColors = [PresetColors.Custom.rawValuePresetColors.Red.rawValue, PresetColors.Green.rawValue, PresetColors.Blue.rawValue]

let presetLabel: Float -> String = { self.presetColors[Int($0 * Float(self.presetColors.count - 1))] }

SnapSwiftParameter(label: "Color Preset", normalisedValue: 0, labelFunction: presetLabel, stringValues: presetColors)

However, there's an issue when panning left and right - sometimes there's an assertion failure in UICollectionViewData indexPathForItemAtGlobalIndex:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'request for index path for global index 0 when there are only 0 items in the collection view'

This seems to be a known issue with animated inserts and deletes on UICollectionView instances and I'm working on a fix.

FlexMonkey commented 9 years ago

Fixed - I no longer use UICollectionViews for the wings. Wings are now CALayers which have their origins updated as the selected index changes. Code is a bit scrappy (done on the Tube), but at least it's working. Documentation coming soon...!