Reputation: 16469
For my app, it currently performs some logic and I also have a segment control
deselected with:
[self.tipControl setSelectedSegmentIndex:UISegmentedControlNoSegment];
I could leave this as is, but I want to have the option of reenabling this to perform other functions. This is what I have right now
if (true) {...
...
...
[self.tipControl setSelectedSegmentIndex:UISegmentedControlNoSegment];
}
activate segmented control onclick //allowing selecting of segments
if (self.segmentedcontrol.selectedSegmentIndex >= 0){
... do something...;
}
Upvotes: 1
Views: 90
Reputation: 5667
Where ever you want to enable segment control kindly put code like this :
..
..
[self.tipControl setSelectedSegmentIndex:0]; // this will enable first segment
..
..
// similarly you can enable other segments with changing index.
Hope this helps you.
Upvotes: 2