数値型から文字型にしてテキストフィールドへ返す

参考元http://gihyo.jp/dev/serial/01/iphone/0005?page=2

  • (BOOL)textFieldShouldReturn:(UITextField *)textField {

[textField resignFirstResponder];
return YES;
}

  • (IBAction)executeCalc:(id) sender {


[income resignFirstResponder];
[cost resignFirstResponder];
int str = [income.text intValue];
int str2 = [cost.text intValue];
int str3 = str - str2;

[dpi setText:[NSString stringWithFormat:@"%d", str3]];


UIAlertView *alert = [[UIAlertView alloc]

initWithTitle:@"information"
message:@"いんふぉめーしょんだよ"
delegate:self
cancelButtonTitle:@"ok"
otherButtonTitles:@"website",nil ];
alert.message=[NSString stringWithFormat:@"%d", str3];

[alert show];
[alert release ];
[income setText:[NSString stringWithFormat:@"%d", str3]];

}