#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *intervalSecond;
@property (weak, nonatomic) IBOutlet UITextField *fpsCount;
@property (weak, nonatomic) IBOutlet UILabel *speedCount;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self speedKeisan];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void) speedKeisan
{
// 要素値の取得 NSString:文字列の値 テキストから文字列に代入
NSString *intStr = _intervalSecond.text;
NSString *fpsStr = _fpsCount.text;
// 要素値のintValue 文字→数字 型変換 int:数値を扱う値
int interval = [intStr intValue];
int fpsSuu = [fpsStr intValue];
//数値speedを作成して計算
int speed = interval * fpsSuu;
//速さのテキスト変数を作って数字をテキストに変換
NSString *speedStr = [NSString stringWithFormat:@"%d倍速",speed];
//速さを表示
self.speedCount.text = speedStr;
}
@end