Skip to content

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

@sherwoodyao

Description

@sherwoodyao

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions