gpt4 book ai didi

ios - 将所选值放入文本字​​段中

转载 作者:行者123 更新时间:2023-11-29 05:05:10 25 4
gpt4 key购买 nike

当用户在 pickerView 中选择一个项目并按“确定”按钮时,我必须将所选项目放入 UITextField 中,那么在“确定”按钮的 IBAction 中我应该放置什么?提前谢谢:)这是我的“确定”按钮代码:

-(IBAction)okButton{
[billTotal setText:@"Hi"];//the text field name is billTotal, this didn't work :(

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
CGAffineTransform transform = CGAffineTransformMakeTranslation(0, 480);
pickerView.transform = transform;
[UIView commitAnimations];
}

最佳答案

像这样:

...
NSInteger selectedRow = [picker selectedRowInComponent:0];
billTotal.text = [NSString stringWithFormat:@"%d", selectedRow];
...

This didn't work

检查您的 socket 是否连接到文本字段,并且调用“okButton”选择器

关于ios - 将所选值放入文本字​​段中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5679096/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com