开发者

How to combine the values of pickerview with textview?

开发者 https://www.devze.com 2022-12-09 14:38 出处:网络
In My Application pressing the submit button i wanted to perform submit operation but i don\'t know how combine the textview\'s value with pickerview\'开发者_如何学Pythons value.if it is possible then

In My Application pressing the submit button i wanted to perform submit operation but i don't know how combine the textview's value with pickerview'开发者_如何学Pythons value.if it is possible then show me code with example.


How would you like to combine the values, as a string?

If you simply want to combine them in a single string, here's an example of how you can do it:

- (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...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消