Created
November 27, 2009 15:27
-
-
Save quique123/244063 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PublicTimelinesViewController.h | |
// P3Scratch | |
// | |
// Created by Marcio Valenzuela on 11/25/09. | |
// Copyright 2009 Personal. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import "TwitterHelper.h" | |
@interface PublicTimelinesViewController : UITableViewController { | |
NSArray *publicTweetsArray; | |
NSArray *publicUsersArray; | |
NSArray *publicUsers; | |
} | |
@property (nonatomic,retain) NSArray *publicTweetsArray; | |
@property (nonatomic,retain) NSArray *publicUsersArray; | |
@property (nonatomic,retain) NSArray *publicUsers; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PublicTimelinesViewController.m | |
// P3Scratch | |
// | |
// Created by Marcio Valenzuela on 11/25/09. | |
// Copyright 2009 Personal. All rights reserved. | |
// | |
#import "PublicTimelinesViewController.h" | |
@implementation PublicTimelinesViewController | |
@synthesize publicTweetsArray; | |
@synthesize publicUsersArray; | |
@synthesize publicUsers; | |
#pragma mark for Data methods | |
- (id)initWithStyle:(UITableViewStyle)style { | |
// Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. | |
if (self = [super initWithStyle:style]) { | |
} | |
return self; | |
} | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
//Blocking the main thread, just to see how it works | |
publicTweetsArray = [TwitterHelper fetchPublicTimeline]; | |
publicUsersArray = [publicTweetsArray valueForKey:@"user"]; | |
publicUsers = [publicUsersArray valueForKey:@"name"]; | |
NSLog(@"%@, %i", publicUsers, [publicUsers count]); | |
[self.tableView reloadData]; | |
// Uncomment the following line to display an Edit button in the navigation bar for this view controller. | |
// self.navigationItem.rightBarButtonItem = self.editButtonItem; | |
} | |
- (void)didReceiveMemoryWarning { | |
// Releases the view if it doesn't have a superview. | |
[super didReceiveMemoryWarning]; | |
// Release any cached data, images, etc that aren't in use. | |
} | |
- (void)viewDidUnload { | |
// Release any retained subviews of the main view. | |
// e.g. self.myOutlet = nil; | |
} | |
#pragma mark Table view methods | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
NSLog(@"NOSIT Public"); | |
return 1; | |
} | |
// Customize the number of rows in the table view. | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
NSLog(@"NORIS Public"); | |
return [publicUsers count]; | |
} | |
// Customize the appearance of table view cells. | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; | |
} | |
// Set up the cell... | |
NSLog(@"here at CFRAIP"); | |
cell.textLabel.text = [publicUsers objectAtIndex:indexPath.row]; | |
return cell; | |
} | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
// Navigation logic may go here. Create and push another view controller. | |
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; | |
// [self.navigationController pushViewController:anotherViewController]; | |
// [anotherViewController release]; | |
} | |
- (void)dealloc { | |
[super dealloc]; | |
[publicTweetsArray release]; | |
[publicUsersArray release]; | |
[publicUsers release]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment