苹果开始拒绝我的应用程序(经过多年的批准)-我有两个文本字段的几个字符的姓,名,然后按下Go。他们声称——我不能重现如果你只按下Go,应用程序就会崩溃的情况——当我运行它时,它试图发送请求,但却以"No name - please reenter"的错误将其踢回。无论什么。为了安抚苹果,我修改了我的文本框输入方法到现在(见下文)-但仍然不能工作。请建议。
// Text Field methods
-(void)textFieldDidBeginEditing:(UITextField *)textField {
UIFont* boldFont = [UIFont fontWithName:@"Helvetica-Bold" size: 24];
if (textField == _lastName) {
[_lastName becomeFirstResponder];
[_lastName setFont:boldFont];
_lastName.autocorrectionType = UITextAutocorrectionTypeNo;;
_lastName.autocapitalizationType = UITextAutocapitalizationTypeNone;
_lastName.text = @"";
NSLog(@"user editing last...");
// Enable button once fields have values
if ([_lastName.text isEqual: @""] && [_firstName.text isEqual: @""])
{
_fwdButton.enabled = YES;
}
}
else {
[_firstName becomeFirstResponder];
[_firstName setFont:boldFont];
_firstName.autocorrectionType = UITextAutocorrectionTypeNo;;
_firstName.autocapitalizationType = UITextAutocapitalizationTypeNone;
_firstName.text = @"";
NSLog(@"user editing first");
// Enable button once fields have values
if ([_lastName.text isEqual: @""] && [_firstName.text isEqual: @""])
{
_fwdButton.enabled = YES;
}
}
}
我可以添加类似于[https://stackoverflow.com/questions/2859821/disable-button-until-text-fields-have-been-entered][1]的代码
处理这种情况