标签:style blog http io for sp on 2014 log
@property (weak, nonatomic) IBOutlet UITextField *Text1;
@property (weak, nonatomic) IBOutlet UITextField *Text2;
@property (weak, nonatomic) IBOutlet UILabel *result;
- (IBAction)GetResult:(id)sender {
NSString * t1 = [_Text1 text];
NSString * t2 = [_Text2 text];
NSInteger tt1 = [t1 integerValue];//将指针转换成long型
NSInteger tt2 = [t2 integerValue];
NSInteger a = tt1 +tt2;
[_result setText:[NSString stringWithFormat:@"%ld",a]]; //在_result中显示结果
[self.view endEditing:YES];//关闭键盘
}
最简答的加法计算器 关闭键盘的方法 [_result setText:[NSString stringWithFormat:@"%ld",a]];
标签:style blog http io for sp on 2014 log
原文地址:http://www.cnblogs.com/Mr573/p/4073724.html