Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating label based on picker value the very first time a view is loaded
    primarykey
    data
    text
    <p>I'm new to iPhone development, so my apologies if this is a ridiculous question.</p> <p>I'm following a sample from a book where it creates a exchange rate UIPicker and when you select one of the entries, it displays the conversion of US dollars into whatever currency is picked.</p> <p>I want the value to be updated in my label before I start changing the value from the picker.</p> <p>The very first time i enter my US dollar value in the textbox and I click on the "Return" button, i want the label to update and displays its equivalent value in whatever currency is currently selected in the picker.</p> <p>I have the correct code in the didSelectRow event, and that part works as long as i start spinning the picker's component wheels, so I thought I'd take that code and put it in a function which would have one parameter i.e. row and this function would then be called from didSelectRow where the row parameter would be passed and then I would:</p> <p>This is the code from the didSelectRow:</p> <pre><code>float rate = [[exchangeRates objectAtIndex:row] floatValue]; float dollars = [dollarText.text floatValue]; float result = dollars * rate; NSString *resultString = [[NSString alloc] initWithFormat:@"%.2f USD = %.2f %@", dollars, result, [countryNames objectAtIndex:row]]; resultLabel.text = resultString; [resultString release]; </code></pre> <p>Call this function when the "Did End on Exit" event for the textbox but my I'm having two problems:</p> <ol> <li><p>What is the correct way to write the function. Whatever way I write the function, I get various errors/warnings</p></li> <li><p>How do i get the currently select row of the picker, so that I can pass it to this function when the "Did End on Exit" event occurs when i click on the "Return" button.</p></li> </ol> <p>Thanks</p> <p>T.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload