Skip to content

MagicViewController

rpinto edited this page Mar 18, 2014 · 4 revisions

MagicViewController is a subclass of UIViewController. It's the main class of the MagicTableView.

Into your subclass of MagicViewController

  • override the initMagicModel methods and init and set the Magic Model :
- (void)initMagicModel
{
    YourMagicModel* lMagicModel = [[YourMagicModel alloc] init];

    self.mModel = lMagicModel;

    [lMagicModel release];
}
  • override the tableView:cellForRowAtIndexPath: methods to create your own cell.

  • override the tableView:heightForRowAtIndexPath: methods to set your cells height.

  • in your view controller .xib, add a UITableView, override its class to MagicTableView. Link the reference outlet to your view controller mTableView variable. Link your view controller as the UITableViewDelegate and the UITableViewDataSource.

Customization

  • override the initMagicPullToRefreshView methods to set your own pull to refresh view or change the default MagicPullToRefreshView frame.

  • override the initDefaultPagingTableFooterView methods to set your own paging table footer view.

  • override the initDefaultLoadingView methods to set your own loading view displayed when no data are available.

  • override the MagicTableViewEmptyStateView: methods and return your custom empty view. Called when a the model finish loading with no results received.

Behaviour

  • When the viewWillAppear: method is called, it init the MagicModel and the MagicPullToRefreshView.

  • By default the MagicViewController handle the tableView:numberOfRowsInSection: method by returning the number of objects contained into the MagicModel results.

  • If you override the scrollViewDidScroll: or the scrollViewDidEndDragging:, don't forget to call the MagicViewController methods.

Clone this wiki locally