我可以根据 uipickerview 行的值自动更新 uitextview 而无需按任何选择按钮吗?

发布于 2024-08-29 06:51:13 字数 165 浏览 4 评论 0原文

所以我有一个 uipicker 视图,我已经成功地将一些数据从我的数据库加载到其中。我想更新一个文本视图,它位于选择器视图的正上方,每次更改行时。这可能吗?

如果不需要,我想避免按下按钮来显示相应的文本。我可以使文本字段中的值随着选取器视图中所选行的值实时变化吗?任何想法或代码片段将不胜感激。谢谢!

So I have a uipicker view, that I have managed to load some data from my db into. I would like to update a textview, which is right above the pickerview, with each changing of the row. Is that possible?

If I don't have to, I would like to avoid pushing a button in order to show the respective text. Can I make it so that the value in the text field changes with the value of the rowselected in the pickerview, in real time? Any thoughts or code snippets would be appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡写薰衣草的香 2024-09-05 06:51:13

是的,你可以。只需连接到 UIPicker 的

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    if (component == kMyComponent)
    {
        NSString *myValue = [self.infoTypes objectAtIndex:row];
        NSLog(@"hello you selected the value: %@", myValue);
    }
}

Yes, you can. just hook up the connection to the UIPicker's

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    if (component == kMyComponent)
    {
        NSString *myValue = [self.infoTypes objectAtIndex:row];
        NSLog(@"hello you selected the value: %@", myValue);
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文