テキストフィールドを終了するたびに、UIActionsシートが出て、情報を保存することになっています。テキストフィールドを終了すると、プログラムは終了し、コンソールには無効なクラスが呼び出されます。なぜこのコードは動作しませんか?クラスが呼び出されないのはなぜですか?
- (IBAction)classFieldDoneEditing:(id)sender
- (IBAction)classFieldDoneEditing:(id)sender
withActionSheet:(UIActionSheet *)typeSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
self.indicatedClass = classField.text;
NSString *greeting = [[NSString alloc]
initWithFormat:@"%@", indicatedClass];
labelClassTitle.text = greeting;
labelClassTitle.hidden = NO;
[greeting release];
[sender resignFirstResponder];
typeSheet = [[UIActionSheet alloc]
initWithTitle:@"Class types"delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:@"Core Class", @"Elective", nil];
[typeSheet showInView:self.view];
[typeSheet release];
if (buttonIndex == 0) {
self.indicatedClass = classField.text;
NSString *indicatedString = indicatedClass;
NSString *greeting = [[NSString alloc]
initWithFormat:@"%@ meets 6 times per rotation", indicatedString];
labelClassTitle.text = greeting;
labelClassTitle.hidden = NO;
[greeting release];
[indicatedClass release];
}
else if (buttonIndex == 1) {
self.indicatedClass = classField.text;
NSString *indicatedString = indicatedClass;
NSString *greeting = [[NSString alloc]
initWithFormat:@"%@ meets 3 times per rotation", indicatedString];
labelClassTitle.text = greeting;
labelClassTitle.hidden = NO;
[greeting release];
[indicatedClass release];
}
}
私はそれをリンクしました – mentorship