嗨,我是编程的初学者,多年来一直坚持这项任务,似乎无处可去。
基本上我有几个文本字段,当用户按下按钮时,它们会在不同的页面上生成输入信息。我希望在所有文本字段都填满信息之前禁用该按钮。
到目前为止,我有这个:
- (void)textFieldDidEndEditing:(UITextField *)textField
{
// make sure all fields are have something in them
if ((textfbookauthor.text.length > 0)&& (textfbookedition.text.length > 0)&& (textfbookplace.text.length > 0)&& (textfbookpublisher.text.length > 0) && (textfbookpublisher.text.length > 0) && (textfbooktitle.text.length > 0) && (textfbookyear.text.length > 0)) {
self.submitButton.enabled = YES;
}
else {
self.submitButton.enabled = NO;
}
}
问题是“提交按钮”出现错误,需要用什么代替它?我试图将我的按钮“bookbutton”放入其中,但它不起作用。
这是我的“生成”按钮的功能
-(IBAction)bookbutton:(id)sender;
{
NSString* combinedString = [NSString stringWithFormat:
@"%@ %@ %@.%@.%@:%@.",
textfbookauthor.text,
textfbookyear.text,
textfbooktitle.text,
textfbookedition.text,
textfbookplace.text,
textfbookpublisher.text];
BookGenerate*bookg = [[BookGenerate alloc] init];
bookg.message = combinedString;
bookg.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:bookg animated:YES];
[BookGenerate release];
}
如果有人知道我如何使它工作或我需要添加什么,请帮助。
提前致谢