내 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는 "클래스에이 방법이 없습니다"와 같은 오류 만 표시합니다. 모든 파일은 올바르게 importet되므로 이유가 아닙니다. 도움을 주시면 감사하겠습니다. 감사!
두 번째 마지막 단락. 제발, 제발, 좋은 책을 가져와. * iOS 프로그래밍 : The Big Nerd Ranch Guide *는 프로그래밍을 배우기에 가장 좋은 책 중 하나입니다. 부탁을 들어 조금만 읽고 돈을 벌어 책을 읽으십시오. 당신이 지금있는 곳에서 시행 착오를하는 것보다 훨씬 짧은 시간에 훨씬 더 나은 개발자가 될 것입니다. – fzwo