我不能为我的生活弄清楚这里有什么问题。我正在完成一个教程。我仔细检查了我的打字。我甚至复制并粘贴了代码,但我仍然收到此错误。
#import "AddToDoItemViewController.h"
@interface AddToDoItemViewController ()
@end
@implementation AddToDoItemViewController
- (IBAction)textField:(id)sender {
}
- (IBAction)saveButton:(id)sender {
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if (sender != self.saveButton) return;
if (self.textField.text.length > 0) {
self.toDoItem = [[ToDoItem alloc] init];
self.toDoItem.itemName = self.textField.text;
self.toDoItem.completed = NO;
}
}
@end
答案 0 :(得分:0)
在您发布的代码中,您的班级没有名为saveButton
的媒体资源。它有一个名为saveButton:
的方法。因此错误消息似乎是正确的。
答案 1 :(得分:0)
@interface AddToDoItemViewController ()
@property (strong, nonatomic) IBOutlet UIButton *saveButton;
@end