0

I was using a UITableView for developing part of my app and had hence used this following code:

- (void)reload {
    _products = nil;
    [self.tableView reloadData];
    [[RageIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
        if (success) {
            _products = products;
            [self.tableView reloadData];
        }
        //[self.refreshControl endRefreshing];

        [self.tableView reloadData];
        [self.tableView setNeedsDisplay];

    }];
}

However, now I want to use this code in a UIViewController and remove any instances of the tableview entirely. What should I do about the self.tableView areas? How can I make this work?

Sorry if it sounds novice but Im sure its straightforward

Thank you!!

Omar
  • 979
  • 3
  • 16
  • 26
  • Do you mean migrate from `UITableViewController` to `UIViewController`? If you remove `tableView` you won't have a table. – Zach L Jan 07 '14 at 02:02

2 Answers2

1

You should create your UIViewController class first, and then in the storyboard drop a UITableView onto it, make it by the size of the view (if you want it to be like a UITableViewController), and then drag a referencing outlet to the View Controller you've just created (by holding CTRL and dragging). Then, you can access it through self.tableView.

As for your UIRefreshControl, I might suggest reading up this answer, it should help you to migrate completely to a UIViewController. I hope it helps, good luck!

Community
  • 1
  • 1
nemesis
  • 1,349
  • 1
  • 15
  • 30
0

If you do not want to have an instance of UITableView, then please have your UIViewController class sub-classed from UITableViewController.

A Starter example of it is very well explained here by raywenderlich

Just download the starter project & understand the classes.

Hope that helps.

Balram Tiwari
  • 5,657
  • 2
  • 23
  • 41