我无法在我的 tableview 控制器实现中使用我在 tableviewcell 文件中实现的方法之一。我尝试搜索网络和 xcode 帮助,但没有成功。我的代码如下所示:
表视图控制器.h:
#import TableViewCell.h
@interface TableViewController : UITableViewController
@property (nonatomic, strong) IBOutlet UIBarButtonItem *A1Buy;
@property (nonatomic, getter = isUserInteractionEnabled) BOOL userInteractionEnabled;
- (IBAction)A1Buy:(UIBarButtonItem *)sender;
表视图控制器.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 只会给我诸如“类没有此方法”之类的错误。所有文件都正确导入,所以这不是原因。将不胜感激任何帮助。谢谢!