0

I have three UIViewControllers and one separate viewcontroller with UISegmentControl where i have to push 3 viewcontrollers using navigationControllers. I want all these views to appear below UISegmentControl when any segmentcontrol is selected. I tried push and pop logic, but couldn't get the result right. Below is the code for one controller-

-(IBAction)valueChanged:(id)sender{

segmentControl=(UISegmentedControl*)sender;

if (segmentControl.selectedSegmentIndex==1) {

    firstView = [self.storyboard instantiateViewControllerWithIdentifier:@"FirstTopViewController"];

    [self.navigationController pushViewController:firstView animated:YES];

    [self.navigationController popViewControllerAnimated:NO];

    self.navigationController.navigationItem.titleView=segmentControl;


    NSLog(@"1");
    }
}

Can anyone tell me what i'm doing wrong here?

Abdullah Shafique
  • 6,878
  • 8
  • 35
  • 70
Monis Manzoor
  • 183
  • 3
  • 14

0 Answers0