if statement that brings a new window
I'm trying to create a button that triggers an if statement which takes
the content of a text field (which must be a number) and compares it with
some numbers.
IN THE .h FILE I WROTE THIS...
@property (strong, nonatomic) IBOutlet UITextField *textoo;
-(IBAction)Botonn:(id)sender;
IN THE .m FILE I WROTE THIS...
-(IBAction)Botonn
{
if ((_textoo.text>=3)&&(_textoo.text<=5)) {
FirstViewController*first=[[FirstViewController alloc]
initWithNibName:nil bundle:nil];
[self presentViewController:first animated:YES completion:NULL];
}
else {
SecondViewController*second=[[SecondViewController alloc]
initWithNibName:nil bundle:nil];
[self presentViewController:second animated:YES completion:NULL];
}
}
No comments:
Post a Comment