-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
* Just saw this might be a duplicate, sorry - newbie failure*
Hi,
just checked out this nice piece of code (thanks !) and ran into an issue.
I rely on the ability to deselect all segments in the segemented control.
For UISegmentedControl this is possible by setting the selectedSegmentIndex to -1.
URBSegmentedControl has some checks in
- (void)setSelectedSegmentIndex:(NSInteger)selectedSegmentIndex
that do not allow -1 as a value.
Tried the following change as a quick and dirty hack:
//NSParameterAssert(selectedSegmentIndex < (NSInteger)self.items.count && selectedSegmentIndex >= 0);
//20130326 OGGERSCHUMMER fix for unselected control
NSParameterAssert(selectedSegmentIndex < (NSInteger)self.items.count && selectedSegmentIndex >= -1);
// deselect current segment if selected
if (_selectedSegmentIndex >= 0)
((URBSegmentView *)[self segmentAtIndex:_selectedSegmentIndex]).selected = NO;
if (selectedSegmentIndex>=0){//20130326 OGGERSCHUMMER Handle deselection of everything
[self segmentAtIndex:selectedSegmentIndex].selected = YES;
}
...
From what I see this does the trick, but I don´t know your code in detail yet.
Maybe you can check and adjust this.
Cheers,
Oggerschummer
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels