title: addition of two numbers using textfield
body: <p>I am new to objective c,so plz me help with this...
  i have used three textfields in the interface builder
  textfield1 inputs the first number
  textfield2 inputs the second number</p>
  
  <p>and i have created a button called sum which will calculate the sum
  and textfield(ans) will display the result</p>
  
  <p>.h file code</p>
  
  <pre><code> {
        IBOutlet UITextfield txtfield1;
        IBOutlet UITextfield txtfield2;
        IBOutlet UITextfield ans;
   }
   -(IBAction)add;
  </code></pre>
  
  <p>.m file code</p>
  
  <pre><code> -(IBAction)add
    {
        int result=[txtfield1.text intValue]+[txtfield2.text intValue];
        ans.text=[NSString StringWithFormat:@"%d",result];
    }
  </code></pre>
  
  <p>The program runs fine,but i want only integer values to be entered in the textfield,if i enter alphabets and click on the sum button i get 0 as the ans,what can i do so that user gets an error when he inputs alphabets..thanks..   </p>