0

The following method changes the segmented control view from button click but I can't seem to make the selected segmented control item highlighted. I just need show the segmented control index 1 is selected.

- (IBAction)buttonClicked:(id)sender{

[self addChildViewController:searchPageView];
[self.viewContainer addSubview:searchPageView.view];

[self.segmentedControl setSelectedSegmentIndex:1];

}

Dameon Bryant
  • 39
  • 1
  • 6

1 Answers1

0

The code you posted should work. Try adding a breakpoint to your buttonClicked method to ensure that it is being called when the button is pressed. In the debugger make sure that self.segmentedControl is not nil.

dfmuir
  • 2,048
  • 1
  • 17
  • 14