I'm wondering how to record the time taken from running the method below, to when a UIButton is pressed -- could anyone possibly help?
-(void)inf开发者_如何学编程ormToPress
{
textLabel.text = @"Test, press the button";
//begin record and end record on button press
}
Thank you,
-(void)informToPress
{
textLabel.text = @"Test, press the button";
//begin record and end record on button press
startDate = [[NSDate alloc]init];
}
-(IBAction)stopTime{
stopDate = [[NSDate alloc]init];
//The actual time in seconds
NSLog(@"Time in seconds %f", [stopDate timeIntervalSinceDate:startDate]);
}
OR
-(IBAction)calculateTime{
//The actual time in seconds just calculated not stored.
NSLog(@"Time in seconds %f", [startDate timeIntervalSinceNow]);
}
精彩评论