0

I have made a button in ViewController1 and triggered that button to Tab controller in action. Now I want to make a condition on that button that if text view contain 1 it go to tab controller and if text view contain 2 it go to Navigation Controller.

Any idea?

UpL1nK
  • 559
  • 1
  • 6
  • 14
Msbh Malik
  • 11
  • 1

2 Answers2

0

You need to implement the action for the button in code in your controller. The code should check the text content and then instantiate the appropriate view controller and present it.

Wain
  • 118,658
  • 15
  • 128
  • 151
-1

Are you sure you want to use a segue, because the segue often connect a certain view controller. And you can connect the segue to a button.

for segue you can write code like this

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if ([segue.identifier isEqualToString:@"showResult"]) {
    //here you can pass some params to the segue.destinationViewController
}

}

and for your question I thing you can just make a simple judgement.

    if(textView ==1 )
{
    [self presentedViewController:tabController];
}
if(textview== 2){
    self presentedViewController:navigationController];
}
zedzhao
  • 517
  • 1
  • 3
  • 17