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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Abbiamo così terminato questa fase. Salviamo e chiudiamo Interface Builder.<br />

SCRIVIAMO IL CODICE<br />

Dobbiamo definire due elementi e un paio di metodi che non abbiamo scritto inizialmente.<br />

Apriamo il file “ProgressColourViewController.h” e inserite le dichiarazioni mancanti:<br />

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 />

#import <br />

@interface ProgressColourViewController : UIViewController {<br />

! IBOutlet UILabel *progressLabel;<br />

! IBOutlet UIProgressView *progressBar;<br />

!<br />

! IBOutlet UIButton *bottoneBlu;<br />

! IBOutlet UIButton *bottoneRosso;<br />

!<br />

! NSTimer *timer;<br />

! UIColor *colore;<br />

}<br />

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

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

- (IBAction)caricamentoColore:(id)bottone;<br />

- (void)aggiornaColore ;<br />

- (void)applicaColore ;<br />

@end<br />

Abbiamo definito un componente “NSTimer” (alla riga 10), che sarà il temporizzatore che ci<br />

<strong>per</strong>metterà di eseguire l’animazione prevista. Nella riga successiva è definito un elemento UI-<br />

Color, che servirà <strong>per</strong> tener traccia del colore che deve essere applicato allo sfondo.<br />

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

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

Saved successfully!

Ooh no, something went wrong!