
Twitter Trending App
By: a guest on
Mar 8th, 2012 | syntax:
Objective C | size: 0.74 KB | hits: 15 | expires: Never
#import "TrendViewController.h"
#import "CJSONDeserializer.h"
#import "TweetSearchViewController.h"
@implementation TrendViewController
@synthesize trendArray = _trendArray;
#pragma mark -
#pragma mark View lifecycle
#define kTwitterTrendURL @"http://api.twitter.com/1/trends/1.json"
-(void)loadTrends{
NSURL *trendURL = [NSURL URLWithString:kTwitterTrendURL];
NSError* theError = nil;
NSData *trendData = [NSData dataWithContentsOfURL:trendURL];
NSDictionary* jsonDict = [[CJSONDeserializer deserializer]
deserializeAsDictionary:trendData error:&theError];
self.trendArray = [jsonDict objectForKey:@"trends"];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title=@"TwitterApp";
[self loadTrends];
}