Advertisement
Guest User

Untitled

a guest
May 24th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)viewDidLoad {
  2.    
  3.    
  4.    
  5.     //code to add PullToRefresh to the view
  6.     refreshHeaderView = [[PullToRefreshView alloc] initWithScrollView:(UIScrollView *) self.TableView];
  7.     [refreshHeaderView setDelegate:self];
  8.     [self.TableView addSubview:refreshHeaderView];
  9.    
  10.    
  11. }
  12.  
  13. //PullToRefresh methods
  14. - (void)reloadTableData
  15. {
  16.     NSString* WMATA_URL = [NSString stringWithFormat:@"http://api.wmata.com/StationPrediction.svc/json/GetPrediction/C03?api_key=cja73b2fneudh86hk9x4aphr"];
  17.     NSURLRequest *request = [NSURLRequest requestWithURL:
  18.                              [NSURL URLWithString:WMATA_URL]];
  19.     [[NSURLConnection alloc] initWithRequest:request delegate:self];
  20.     responseData = [[NSMutableData data] retain];
  21.     [self.TableView reloadData];
  22.     [self.TableView setHidden:FALSE];
  23.     [self release];
  24.     [refreshHeaderView finishedLoading];
  25. }
  26.  
  27. //refresh methods
  28. - (void)pullToRefreshViewShouldRefresh:(PullToRefreshView *)view;
  29. {
  30.     [self reloadTableData];
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement