rs / SDSegmentedControl

A drop-in remplacement for UISegmentedControl that mimic iOS 6 AppStore tab controls
MIT License
1.2k stars 180 forks source link

cannot set selected segment from NIB other than 1st (crash) #25

Open sherwoodyao opened 11 years ago

sherwoodyao commented 11 years ago

I have two view controller that is to be switched by the SegmentControl, so for the 2nd VC I need to set the selected index to be the 2nd item,

and when I do that in NIB, it crashes 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: selectedSegmentIndex < (NSInteger)self._items.count' because self._items is null when this is called. NSParameterAssert(selectedSegmentIndex < (NSInteger)self._items.count);

and if set "selectedIndex" in viewDidLoad code, then it doesn't show the arrow correctly, the title highlight animate to the right selection, but arrow remains unchanged..

net net, I cannot set the initial selectedIndex to anything other than 1