#import <UIKit/UIKit.h>
@class Twitter_SearchViewController;
@interface LoginViewController : UIViewController
NSMutableData *responseData;
NSMutableArray *tweets;
@property (nonatomic, retain) IBOutlet Twitter_SearchViewController *viewController;
@property (nonatomic, retain) NSMutableArray *tweets;



#import “LoginViewController.h”
#import “JSON.h”
#import “Twitter_SearchViewController.h”
@interface LoginViewController ()


@implementation LoginViewController
@synthesize viewController,tweets;
– (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
return self;

– (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
responseData = [[NSMutableData data] retain];
tweets = [NSMutableArray array];
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@”http://vimeo.com/api/v2/video/38356.json”%5D%5D;
[[NSURLConnection alloc] initWithRequest:request delegate:self];


#pragma mark NSURLConnection delegate methods
– (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0];

– (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[responseData appendData:data];

– (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {

– (void)connectionDidFinishLoading:(NSURLConnection *)connection {
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];

NSMutableArray *allTweets = [responseString JSONValue];

//NSArray *allTweets = [results objectForKey:@”results”];
viewController=[[Twitter_SearchViewController alloc]init];

UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:viewController];

[viewController setTweets:allTweets];

[self presentViewController:nav animated:YES completion:nil];


– (void)didReceiveMemoryWarning
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s