|
-(void) addSpeechControlWithFrame: (CGRect) frame title:(NSString *) title action:(SEL) selector {
UIButton *controlButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
controlButton.frame = frame;
controlButton.backgroundColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
[controlButton setTitle:title forState:UIControlStateNormal];
[controlButton addTarget:self
action:selector forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:controlButton];
}
- (void)addSpeechControls {
[self addSpeechControlWithFrame:CGRectMake(52, 485, 150, 50)
title:@"Lower Pitch"
action:@selector(lowerPitch)];
[self addSpeechControlWithFrame:CGRectMake(222, 485, 150, 50)
title:@"Raise Pitch"
action:@selector(raisePitch)];
[self addSpeechControlWithFrame:CGRectMake(422, 485, 150, 50)
title:@"Lower Rate"
action:@selector(lowerRate)];
[self addSpeechControlWithFrame:CGRectMake(592, 485, 150, 50)
title:@"Raise Rate"
action:@selector(raiseRate)];
[self addSpeechControlWithFrame:CGRectMake(506, 555, 150, 50)
title:@"Speak Again"
action:@selector(speakAgain)];
} |