ios - How do I compare the the text of a UITextField to a string? -


i creating scrambled word game consists of 4 words, , therefore 4 textfields.

when user inputs string length of correct word, want check if sequence equal actual word.

 if is, want clear text field , return "yes!".   if not, want clear text field user can try again.  

example: if actual word "logic" , user enters "golic" guess correct word, want text field clear user can try again.

     if actual word "logic" , user enters "logic", want text field clear , display string "yes!" 

any appreciated!

tie editingdidend action of textfield.

- (ibaction)testtext:(id)sender {     if ([mytextfield.text isequaltostring:@"logic"]) {         mytextfield.text = @"yes";         uialertview *alertview = [[uialertview alloc] initwithtitle:@"yes!" message:nil delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil];         [alertview show];     }     else         mytextfield.text = @""; } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -