Search code examples
iosxcodetableviewreloaddata

iOS: Property 'tableView' not found


My function [ViewController.tableView reloadData] does not work, although I implemented @class ViewController in the .h file and imported #import "ViewController.h" in the .m file.

What am I doing wrong??

--- EDIT ---

Here's my .h file:

@class XMLAppDelegate, XMLProductDetailView;

@interface XMLViewController : UITableViewController <UIScrollViewDelegate, XMLImageDownloaderDelegate> {

    NSMutableDictionary *imageDownloadsInProgress; 

    XMLAppDelegate *appDelegate;
    XMLProductDetailView *productDetailView;
    IBOutlet UISearchBar *searchBar;
    IBOutlet UITableView *tableView;
}

@property (nonatomic, retain) NSMutableDictionary *imageDownloadsInProgress;
@property (nonatomic, retain) IBOutlet UISearchBar *searchBar;
@property (nonatomic, retain) IBOutlet UITableView *tableView;

- (void)imageDidLoad:(NSIndexPath *)indexPath;

@end

But notice: when I include IBOutlet UITableView *tableView;, it hides an instance variable.


Solution

  • ViewController it is class name. You should init instance variable of this class

    ViewController *vc = [[ViewController  alloc] init];
    

    then push it on navigation controller (if it present)

    vc.myDataForTable = [NSArray .....]; //for example
    
    [self.navigationController pushViewController:vc animated:YES];
    

    release vc if arc is not used

    [vc release];