XCODE 4.3.2 版。这让我头疼不已,试图弄清楚如何做本教程。我已经对照他们的代码检查了代码,它看起来是正确的。我下载了别人的副本,它可以工作,但是我的副本完成并且取消不起作用。AddSightingViewController.m 代码如下所示
#import "AddSightingViewController.h"
@implementation AddSightingViewController
...
- (IBAction)cancel:(id)sender {
[[self delegate] addSightingViewControllerDidCancel:self];
}
- (IBAction)done:(id)sender {
[[self delegate] addSightingViewControllerDidFinish:self name:self.birdNameInput.text location:self.locationInput.text];
}
...
并且这些行上的调试检查点工作正常但是在 BirdsMasterViewController.m 我有以下代码:
#import "BirdsMasterViewController.h"
#import "BirdsDetailViewController.h"
#import "BirdSightingDataController.h"
#import "BirdSighting.h"
#import "AddSightingViewController.h"
@interface BirdsMasterViewController () <AddSightingViewControllerDelegate>
@end
@implementation BirdsMasterViewController
@synthesize dataController = _dataController;
...
- (void)addSightingViewControllerDidCancel:(AddSightingViewController *)controller {
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)addSightingViewControllerDidFinish:(AddSightingViewController *)controller name:(NSString *)name location:(NSString *)location {
if ([name length] || [location length]) {
[self.dataController addBirdSightingWithName:name location:location];
[[self tableView] reloadData];
}
[self dismissModalViewControllerAnimated:YES];
}
...
这些行上的调试检查点永远不会停止我的代码上的程序(但会在下载的代码上停止)。我到底想念什么才能让它发挥作用。