Objective c UITableView存在于.h文件中,但.m文件表示tableView不存在?

Objective c UITableView存在于.h文件中,但.m文件表示tableView不存在?,objective-c,uitableview,view,uiviewcontroller,xcode4.5,Objective C,Uitableview,View,Uiviewcontroller,Xcode4.5,所以这是一个相当基本的问题(不知道为什么会发生在我身上)。。。UITableView显然存在于我的.h文件中,但出于某种原因,当我在我的.m文件中调用tableView时,它会说,“在ViewController类型的对象上找不到属性tableView”。当我将@interface行中的“UIViewController”更改为“UITableViewController”时,应用程序会向我抛出一个错误?帮助:) .h @interface ViewController : UIViewCont

所以这是一个相当基本的问题(不知道为什么会发生在我身上)。。。UITableView显然存在于我的.h文件中,但出于某种原因,当我在我的.m文件中调用tableView时,它会说,“在ViewController类型的对象上找不到属性tableView”。当我将@interface行中的“UIViewController”更改为“UITableViewController”时,应用程序会向我抛出一个错误?帮助:)

.h

@interface ViewController : UIViewController <PickerViewControllerDelegate> {

    IBOutlet UITableView *strainTableView;

NSArray *Strains;
NSArray *searchResults;

NSMutableData *data;
NSMutableArray *dataArray;

}

@property (nonatomic, retain) NSArray *searchResults;


@end

但是您没有
tableView
属性,只有
strainTableView
变量。我遗漏了什么吗?好的,那么TableView连接到了实际的UITableView对象(在我的故事板上)。当我创建TableView作为一个属性,然后将其链接到UITableView时,我得到一个错误。请注意,TableView对象位于常规ViewController内部。我不知道是否可以将两个
IBOutlet
s连接到NIB中的同一对象。不过,您应该能够将
straintTableView
设置为属性。将其重命名为仅
tableView
也可以。尝试了这两种方法。如果我将straintTableView设置为属性,例如:@property(非原子,强)IBOutlet UITableView*straintTableView,则会导致错误…啊,修复了它。从我的财产中移除插座。改为:@property(强,非原子)UITableView*tableView;
- (void)checkButtonTapped:(id)sender event:(id)event
{
    NSSet *touches = [event allTouches];
    UITouch *touch = [touches anyObject];
    CGPoint currentTouchPosition = [touch locationInView:self.tableView];
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
    if (indexPath != nil)
    {
        [self tableView: self.tableView accessoryButtonTappedForRowWithIndexPath: indexPath];
    }
}