Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Beginning iOS5 Development.pdf
Скачиваний:
7
Добавлен:
09.05.2015
Размер:
15.6 Mб
Скачать

CHAPTER 16: Drawing with Quartz and OpenGL

601

Updating BIDViewController

We need to make a few minor changes in BIDViewController.m. One is to change all references to BIDQuartzFunView to BIDGLFunView. First, replace the line

#import "BIDQuartzFunView.h"

with

#import "BIDGLFunView.h"

Next, replace the changeColor: method with the following version:

- (IBAction)changeColor:(id)sender { UISegmentedControl *control = sender;

NSInteger index = [control selectedSegmentIndex];

BIDGLFunView *glView = (BIDGLFunView *)self.view;

switch (index) {

 

case kRedColorTab:

 

glView.currentColor =

[UIColor redColor];

glView.useRandomColor

= NO;

break;

 

case kBlueColorTab:

 

glView.currentColor =

[UIColor blueColor];

glView.useRandomColor

= NO;

break;

 

case kYellowColorTab:

 

glView.currentColor =

[UIColor yellowColor];

glView.useRandomColor

= NO;

break;

 

case kGreenColorTab:

 

glView.currentColor =

[UIColor greenColor];

glView.useRandomColor

= NO;

break;

 

case kRandomColorTab:

 

glView.useRandomColor

= YES;

break;

 

default:

 

break;

 

}

 

}

And, finally, in the changeShape: method, change this line:

[(BIDQuartzFunView *)self.view setShapeType:[control selectedSegmentIndex]];

to this:

[(BIDGLFunView *)self.view setShapeType:[control selectedSegmentIndex]];

www.it-ebooks.info

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]