我在设置数据控制器的简单应用程序时遇到问题。我@property (strong, nonatomic) BirdsListDataController *dataController;
在 BirdsListViewController.h 中遇到错误。我已尽力使用 BirdsListDataController 的 @class 声明,并尝试从 .h 文件中删除任何 #import 语句,并尝试删除循环 #import,您可以在 BirdsListViewController 顶部找到已注释掉的循环。 H。我猜这很简单。
BirdsListViewController.h
#import <UIKit/UIKit.h>
@class BirdsListDataController;
@interface BirdsListViewController : UITableViewController <UITextFieldDelegate>
{
// NSMutableArray *listOfBirds;
IBOutlet UITextField *addNewBirdTextField;
}
//@property (nonatomic, retain) NSIndexPath *checkedIndexPath;
@property (nonatomic, retain) NSString *textLabelContents;
@property (nonatomic, retain) NSMutableArray *workingArray;
@property (strong, nonatomic) BirdsListDataController *dataController;
@property (strong, nonatomic) IBOutlet UITableView *birdListTableView;
@end
BirdsListViewController.m
#import "BirdsListViewController.h"
#import "BirdsListDataController.h"
@interface BirdsListViewController ()
@end
@implementation BirdsListViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
...
BirdsListDataController.h
#import <Foundation/Foundation.h>
@class BirdName;
@interface BirdsListDataController : NSObject
@property (nonatomic, copy) NSMutableArray *listOfBirds;
-(NSUInteger)countOfList;
-(BirdName *)objectInListAtIndex:(NSUInteger)theIndex;
-(void)addBirdNameWithName:(BirdName *)bName;
@end
BirdsListDataController.m
#import "BirdsListDataController.h"
//#import "BirdsListViewController.h"
#import "Bird.h"
@implementation BirdsListDataController
-(id)init
{...
我对 iOS 和 Objective C 还是很陌生,所以希望我的代码不会太糟糕而无法排除故障。谢谢您的帮助。