-
Notifications
You must be signed in to change notification settings - Fork 0
MagicModel
MagicModel is a subclass of NSObject.
-
Override the
sendRequestmethods to request datas (from Coredata or an API). Use theself.mPageandself.mPerPageas parameters. -
Call
didReveicedErrorif an error occures while requesting datas. -
Call
didReceiveResults:with a sorted object list when you finished to request datas.
-
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 theloadLocalResultsand 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
resetListmethod.
-
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.