Chris Dolce
Chris Dolce

Reputation: 1

iphone app switching view with a picker

is it possible to switch views using a picker and a button? for instance say i have a picker with various animals and i select frog in the picker and press a button under the picker and it takes me to a view for frogs. i have been trying to figure this out for the last three days and havent been able to figure anything out.

i would be greatly appreciated if you could help me!!!!

 -(void)pickerView:(UIPickerView *)pickerView 
didSelectRow:(NSInteger)row 
  inComponent:(NSInteger)component{
if (row == 1){
    self.view = Cig;
}
}

i have tried something like this but resized its not attached to my button.

Upvotes: 0

Views: 87

Answers (1)

Todd Hopkinson
Todd Hopkinson

Reputation: 6883

Are you forgetting to add the frog view?

// Assume that you have a contentView that is visible
// and then a frogView to add to it when the button is pressed...
[contentView addSubview:frogView];

Upvotes: 1

Related Questions