Skip to content
rpinto edited this page Mar 18, 2014 · 5 revisions

MagicModel is a subclass of NSObject.

Into your subclass of MagicViewController

  • Override the sendRequest methods to request datas (from Coredata or an API). Use the self.mPage and self.mPerPage as parameters.

  • Call didReveicedError if an error occures while requesting datas.

  • Call didReceiveResults: with a sorted object list when you finished to request datas.

Customization

  • mResults is the MutableArray containing sorted NSObjects. These are your results.

  • mPage is the current page

  • mPerPage is the number of results requested at one time.

  • mIsLoading is a BOOL indicating if the model is currently requesting

  • mRequestCallDeltaTime represent the duration between two calls of sendRequest. When you set this value you have to override the loadLocalResults and manually set mResults objects :

- (void)loadLocalResults
{
    NSArray* lManuallyRequestedObject;
    
    self.mResults = [NSMutableArray arrayWithArray:lManuallyRequestedObject];
}
  • If you want to reset the search from the beginning, call the resetList method.

Getting Pull To Refresh and Paging events

  • Override magicTableViewDidTriggerPaging: to get notified when the paging is triggered. Don't forget to call the super.

  • Override magicPullToRefreshDidTriggerPullToRefresh: to get notified when the pull to refresh is triggered. Don't forget to call the super.

Clone this wiki locally