如何使输出取决于UIPicker行选择。
|
我需要单个组件UIPicker来显示不同的文本并根据选择的行来执行不同的操作。我正在定义文本,所以它不是选择器读取的内容。第一,第二和第三都是NSString。我找不到正确的代码来使操作依赖于UIPicker行。这是我最后的尝试...
-(IBAction)example {
if (UIPickerView *)examplepick didSelectRow:(NSInteger)0 inComponent:(NSInteger)0 {
NSString *finalMessage = [[NSString alloc] initWithFormat: @\"Say \\\"%@\\\"\", first];
select1.text = first;
display.text = finalMessage;
} else {
if (UIPickerView *)examplepick didSelectRow:(NSInteger)1 inComponent:(NSInteger)0 {
NSString *finalMessage = [[NSString alloc] initWithFormat: @\"Say \\\"%@\\\"\", second;
select1.text = second;
display.text = finalMessage;
} else {
if (UIPickerView *)examplepick didSelectRow:(NSInteger)2 inComponent:(NSInteger)0 {
NSString *finalMessage = [[NSString alloc] initWithFormat: @\"Say \\\"%@\\\"\", third];
select1.text = third;
display.text = finalMessage;
}
}
}
}
没有找到相关结果
已邀请:
1 个回复
翁茄口霉氖
中的
方法。这是使用它的示例的粗略实现。