我无法使用我在我的tableview控制器实现中的tableviewcell文件中实现的方法之一。我试图搜索网页和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只给了我像“类没有这种方法”和类似的东西的错误。所有文件都正确导入,所以这不是为什么。 希望得到任何帮助。谢谢!
我第二段最后一段。请为你自己写一本好书。 * iOS编程:Big Nerd Ranch Guide *是轻松学习编程的最佳书籍之一。请帮你一个忙,花点时间和金钱去读,阅读本书。在短短的时间内,您将成为一个更好的开发人员,而不仅仅是从现在的位置进行反复试验。 – fzwo