tableview コントローラーの実装で、tableviewcell ファイルに実装したメソッドの 1 つを使用できません。Web と xcode のヘルプを検索してみましたが、うまくいきませんでした。私のコードは次のようになります。
TableViewController.h:
#import TableViewCell.h
@interface TableViewController : UITableViewController
@property (nonatomic, strong) IBOutlet UIBarButtonItem *A1Buy;
@property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled;
- (IBAction)A1Buy:(UIBarButtonItem *)sender;
TableViewController.m:
@implementation A1ViewController
@synthesize A1Buy = _A1Buy;
@synthesize userInteractionEnabled;
- (IBAction)A1Buy:(UIBarButtonItem *)sender {
[TableViewCell Enable]; //this is where it gives an error
}
TableViewCell.h:
@interface TableViewCell : UITableViewCell {
BOOL Enable;
BOOL Disable;
}
@property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled;
TableViewCell.m:
@implementation TableViewCell;
@synthesize userInteractionEnabled;
- (BOOL) Enable {
return userInteractionEnabled = YES;
}
- (BOOL) Disable {
return userInteractionEnabled = NO;
}
ご覧のとおり、ボタンを使用したユーザー操作を有効にしようとしていますが、Xcode では「クラスにこのメソッドがありません」などのエラーしか表示されません。すべてのファイルが正しくインポートされているので、そうではありません。助けていただければ幸いです。ありがとう!