1
在我的應用程序中按下提交按鈕,我想執行提交操作,但我不知道如何將textview的值與pickerview的value結合起來。如果可以用示例向我展示代碼。如何將pickerview的值與textview結合起來?
在我的應用程序中按下提交按鈕,我想執行提交操作,但我不知道如何將textview的值與pickerview的value結合起來。如果可以用示例向我展示代碼。如何將pickerview的值與textview結合起來?
您希望如何將字符串的值組合起來?
如果你只是想他們在一個單一的字符串相結合,這裏是你如何能做到這一個例子:
- (IBAction)submitPressed:(id)sender {
// Load the selected row for the first component in your picker view
// If you have more than one component you may need to look up more
// Also, you may need to translate this number into something more meaningful
// such as what the selected row represents
int selectedRow = [pickerView selectedRowInComponent:0];
NSString *myString = [NSString stringWithFormat:@"%@ %d",
textView.text, selectedRow];
// Do something with myString...
}