I am trying to implement UIRefreshControl in my application. I have an xib file, and I added a UITableViewController to an empty nib file, and I set the refresh property to "enabled". In addition, I added code to viewDidLoad and a custom update method. The problem is that I have an error. I canโt find any information about .... in my viewDidLoad I get the property ' refreshControl ' not found on object of type ViewController "
- (void)viewDidLoad{ [super viewDidLoad]; self.myTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; self.myTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.myTableView.delegate = self; self.myTableView.dataSource = self; [self.view addSubview:self.myTableView]; UIRefreshControl *refresh = [[UIRefreshControl alloc] init]; refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"]; [refresh addTarget:self action:@selector(refreshView:) forControlEvents:UIControlEventValueChanged]; self.refreshControl = refresh; } -(void)refreshView:(UIRefreshControl *)refresh { refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Refreshing data..."];
I have no idea why this property is not available .... what am I missing?
It looks like I need to inherit from the UITableViewController in my ViewController.h file. If I already have a UITableView , how do I inherit from both? If I change my code from ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> to ViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> , then I get the error message:
error: NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "ViewController_iPhone" nib but didn't get a UITableView.'
source share