I am using the EGOTableViewPullRefresh library in my iOS app. In order to implement it, I had to change my original class from a subclass of UIViewController to UITableViewController. This apparently broke the way I store my data, e.g. in an NSMutableArray.
header:
#import <UIKit/UIKit.h>
#import "EGORefreshTableHeaderView.h"
@interface PullViewController : UITableViewController <EGORefreshTableHeaderDelegate, UITableViewDelegate, UITableViewDataSource>{
NSArray *news;
NSMutableArray *data;
EGORefreshTableHeaderView *_refreshHeaderView;
// Reloading var should really be your tableviews datasource
// Putting it here for demo purposes
BOOL _reloading;
}
- (void)reloadTableViewDataSource;
- (void)doneLoadingTableViewData;
@end
implementation:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
data = [[NSMutableData alloc] init];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)theData{
[data appendData:theData];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
news = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
[self.tableView reloadData];
[DejalBezelActivityView removeViewAnimated:YES];
}
Try this one
from
Also,
Are you sure data is of kind Array? or it should be NSMutableData..check it once 🙂