-
Notifications
You must be signed in to change notification settings - Fork 191
Open
Description
I'm calling a method that updates the UI depending on the current selected segment index. But the code doesn't work because the selectedSegmentIndex has not yet been updated when the handler is called.
You can see in the log from this statement that they are not in sync, selectedSegmentIndex is always one step behind:
self.segmentedControl.changeHandler = ^(NSUInteger newIndex) {
NSLog(@"New index: %d, Current index: %d", newIndex, self.segmentedControl.selectedSegmentIndex);
[self updateUI];
};
The regular event works fine and selectedSegmentIndex is updated when the below method is called. But I like blocks much better, too bad it doesn't work as good.
[self.segmentedControl addTarget:self action:@selector(segmentedControlChangedValue) forControlEvents:UIControlEventValueChanged];
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels