1 Reply
      Latest reply on Sep 12, 2019 1:42 PM by Claude31
      Stunner Level 1 Level 1 (0 points)

        I asked this question earlier today: https://stackoverflow.com/q/57904625/347339

         

        The proposed solution seems very hacky to me... Is this something Apple overlooked for iOS 13? Has anyone else encountered this and has come up with not a "hacky" solution?

        • Re: Specifying UISegmentedControlNoSegment to UISegmentedControl's selectedSegmentIndex has no Effect on iOS 13
          Claude31 Level 8 Level 8 (6,515 points)

          Which assignment is not respected ? When you set a negative value ?

           

          Could you post your code here also, for convenience (video on SO is OK, but code should also be visible here).

           

          Some checks:

          - Did you check that isMomentary is false ?

          - in the following

           

          - (void)textFieldDidEndEditing:(UITextField *)textField {
            NSInteger integer = [textField.text integerValue];
            if (integer < 0 || integer >= self.segmentedControl.numberOfSegments) { this doesn't work
            self.segmentedControl.selectedSegmentIndex = UISegmentedControlNoSegment;
            } else { // this works
            self.segmentedControl.selectedSegmentIndex = integer;
            }
          }

           

          could you test the value of integer

          could you try to add a setNeedsDisplay on the segmentyedControl after line 4