Hello.

I have a project in Xcode. It has a View controller, on which the text field is located. It is necessary to make so that at input of a certain word other View controller opened. How to do it?

Thank.

  • What about the materiel ?? Gugel ??? Read, understand, and not you on the simplest question create a quest. Then something and learn, IMHO. - AlessandroDP

1 answer 1

UITextFieldDelegate method:

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 

View what is being introduced, and make the transition to a new view controller in a way that you like.

  • I actually thought of doing so: - (IBAction) textFieldDidEndOnExit: (UITextField *) sender {[sender resignFirstResponder]; if ([sender.text isEqualToString: @ "open2"]) {}} But I don’t know what to write in the second braces. Or you can not do this? - Ruslan_T
  • @Ruslan_T, so why do you need action? You yourself wrote that "It is necessary to make it so that when you enter a certain word ...". If you want to click a button, then it is even easier. if ([self.textField.text isEqualToString: @ "open2"]) {TwoVK * twoVK = [[TwoVK alloc] init]; [self presentViewController: twoVK animated: YES completion: nil]; } - AlessandroDP
  • For some reason, when you start an application with this code, after entering the phrase open2, a black screen appears, what could have gone wrong? - Ruslan_T