20.04.2013 Views

Tutorial pratici per iPhone SDK v1.6 - Get a Free Blog

Tutorial pratici per iPhone SDK v1.6 - Get a Free Blog

Tutorial pratici per iPhone SDK v1.6 - Get a Free Blog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

14<br />

15<br />

16<br />

17<br />

18<br />

19<br />

20<br />

21<br />

22<br />

23<br />

24<br />

#import <br />

#import "MGTwitterEngine.h"<br />

@class Tweet;<br />

@class TabellaTwitterViewController;<br />

@interface SampleTwitterClientViewController : UIViewController<br />

{<br />

! MGTwitterEngine *twitterEngine;<br />

! NSMutableArray *listaTweet;<br />

!<br />

! IBOutlet UIActivityIndicatorView *spinner;<br />

!<br />

! TabellaTwitterViewController *tabellaTwitterViewController;<br />

}<br />

-(NSString*)getMessaggio:(NSDictionary*)element;<br />

-(NSString*)getUser:(NSDictionary*)element;<br />

-(NSURL*)getUrlImage:(NSDictionary*)element;<br />

@pro<strong>per</strong>ty (nonatomic, retain) NSMutableArray *listaTweet;<br />

@pro<strong>per</strong>ty (nonatomic, retain) IBOutlet UIActivityIndicatorView<br />

*spinner;<br />

@pro<strong>per</strong>ty (nonatomic, retain) IBOutlet TabellaTwitterViewController<br />

*tabellaTwitterViewController;<br />

@end<br />

Andiamo, poi, nel file “SampleTwitterClientViewController.m”. Modifichiamo le dichiarazioni<br />

e le importazioni nel seguente modo:<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

#import "SampleTwitterClientViewController.h"<br />

#import "Tweet.h"<br />

#import "TabellaTwitterViewController.h"<br />

@implementation SampleTwitterClientViewController<br />

@synthesize listaTweet, spinner, tabellaTwitterViewController;<br />

Modifichiamo, ora, il metodo “statusesReceived: forRequest:”, inserendo il seguente codice alla<br />

fine di tale metodo:<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

[elemento release];<br />

!<br />

self.tabellaTwitterViewController.lista = self.listaTweet;<br />

!<br />

[spinner stopAnimating];<br />

!<br />

[self presentModalViewController:self.tabellaTwitterViewController<br />

animated:YES];<br />

<strong>Tutorial</strong> <strong>pratici</strong> <strong>per</strong> <strong>iPhone</strong> <strong>SDK</strong>! 153

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!