title: Cast an Objective C UITextField value to float
body: <p>I have a UITextField called txtDiscount
  It has a value in it: txtDiscount.text == 2.3 //for example</p>
  
  <p>I've tried:</p>
  
  <pre><code>float test = (NSNumber *)txtDiscount.text;
  </code></pre>
  
  <p>And it compiles, but at runtime breaks down.</p>
  
  <blockquote>
    <p>Unacceptable type of value for attribute: property = ..."; desired type = NSNumber; given type = NSCFString; value = .</p>
  </blockquote>
  
  <p>How can I cast the value?</p>
  
  <p>Any help greatly appreciated,
  Thanks // :)</p>