Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 2.78 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. - (NSInteger)tableView:(UITableView *)tableViews numberOfRowsInSection:(NSInteger)section {
  2.        
  3.         return [tweetArray count];
  4. }
  5.  
  6. - (UITableViewCell *)tableView:(UITableView *)tableViews cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  7.        
  8.         static NSString *CellIdentifier = @"Cell";
  9.    
  10.     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  11.     if (cell == nil) {
  12.         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
  13.                
  14.         AGTweet *tweet = [tweetArray objectAtIndex:indexPath.row];
  15.        
  16.  
  17.         cell.textLabel.text = [NSString stringWithFormat:@"@%@", [tweet trendName]];
  18.        
  19.        
  20.         NSLog(@"%@", [tweet trendName]);
  21.        
  22.         }
  23.        
  24.  
  25.         return cell;
  26. }
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  34. - (void)viewDidLoad {
  35.     [super viewDidLoad];
  36.        
  37.    
  38.     navBar.layer.contents = (id)[UIImage imageNamed:@"navBar.png"].CGImage;
  39.    
  40.    
  41.         twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
  42.         [twitterEngine setConsumerKey:kOAuthConsumerKey secret:kOAuthConsumerSecret];
  43.        
  44.        
  45.         tweetArray = [[NSArray alloc] init];
  46.    
  47.        
  48.         [self refreshTimeline];
  49.     [self refreshButton];
  50.    
  51.        
  52.        
  53.        
  54. }
  55.  
  56.  
  57. - (void)searchResultsReceived:(NSArray *)searchResults forRequest:(NSString *)connectionIdentifier
  58. {
  59.         tweetArray = [[NSMutableArray alloc] init];
  60.        
  61.         for(NSDictionary *d in searchResults) {
  62.                
  63.                 NSLog(@"Dictionary: %@", d);
  64.                
  65.                 AGTweet *tweet = [[AGTweet alloc] tweetDictionary:d];
  66.                 [tweetArray addObject:tweet];
  67.                 [tweet release];
  68.        
  69.                
  70.         }
  71.        
  72.         [tableView reloadData];
  73. }
  74.  
  75. - (void)requestSucceeded:(NSString *)connectionIdentifier
  76. {
  77.         NSLog(@"Twitter request succeeded: %@", connectionIdentifier);
  78. }
  79.  
  80. - (void)requestFailed:(NSString *)connectionIdentifier withError:(NSError *)error
  81. {
  82.         NSLog(@"An error occured: %@", error);
  83.        
  84. }
  85.  
  86.  
  87.  
  88.  
  89.  
  90. - (void)refreshTimeline {
  91.        
  92.         [twitterEngine getCurrentTrends];
  93.     [tableView reloadData];
  94. }
  95.  
  96.  
  97.  
  98.  
  99. /*
  100.  // Override to allow orientations other than the default portrait orientation.
  101.  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  102.  // Return YES for supported orientations
  103.  return (interfaceOrientation == UIInterfaceOrientationPortrait);
  104.  }
  105.  */
  106.  
  107. - (void)didReceiveMemoryWarning {
  108.    
  109.     // Releases the view if it doesn't have a superview.
  110.     [super didReceiveMemoryWarning];
  111.    
  112.     // Release any cached data, images, etc that aren't in use.
  113. }
  114.  
  115. - (void)viewDidUnload {
  116.     [super viewDidUnload];
  117.    
  118.     // Release any retained subviews of the main view.
  119.     // e.g. self.myOutlet = nil;
  120. }
  121.  
  122.  
  123. - (void)dealloc {
  124.     [super dealloc];
  125. }
  126.  
  127.  
  128. @end