简体   繁体   English

iPhone应用程序通过选择器切换视图

[英]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. 我已经尝试过类似的操作,但是调整了其大小,使其未附加到我的按钮上。

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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM