こんにちは、プログラミングの初心者で、このタスクに何年も立ち往生していて、どこにも行かないようです。
基本的に、ユーザーがボタンを押したときに別のページに入力情報を生成するいくつかのテキストフィールドがあります。すべてのテキストフィールドに情報が入力されるまで、ボタンを無効にしたいのですが。
これまでのところ私はこれを持っています:
- (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;
}
}
問題は、「submitButton」がエラーを出していることです。その場所に何を配置する必要がありますか?代わりにボタン「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];
}
誰かが私がそれを機能させる方法や私が追加する必要があるものを知っているなら、助けてください。
前もって感謝します