UITextfield become first responder not working
-
30-10-2019 - |
题
I have a toolbar on top of the keyboard with a prev and next button. When I press the next button the next textfield should become first responder but this doesn't happen. Here is my code.
-(IBAction) nextfield {
if([name isFirstResponder] == TRUE) {
[name resignFirstResponder];
[surname becomeFirstResponder];
if(surname.editing == TRUE)
NSLog(@"surname");
}
if([surname isFirstResponder] == TRUE) {
[email becomeFirstResponder];
}
if([email isFirstResponder] == TRUE) {
[password becomeFirstResponder];
}
if([password isFirstResponder] == TRUE) {
[confirm becomeFirstResponder];
}
if([confirm isFirstResponder] == TRUE) {
[country becomeFirstResponder];
}
if([country isFirstResponder] == TRUE) {
if(country.text == @"United States") {
[state setEnabled:TRUE];
[state becomeFirstResponder];
}
else {
[type becomeFirstResponder];
}
}
if([state isFirstResponder] == TRUE) {
[type becomeFirstResponder];
}
if ([type isFirstResponder] == TRUE) {
[name becomeFirstResponder];
}
}
I get in Log "surname" but the cursor doesn't show up and if i type something it doesn't appear anywhere.
没有正确的解决方案
不隶属于 StackOverflow