2017-04-22 54 views
-4

這裏我的代碼:

- (void)viewDidLoad { 

    [super viewDidLoad]; 

[_stepperName addTarget:self action:@selector(stepperMethodName) forControlEvents:UIControlEventValueChanged]; 

} 

-(void)stepperMethodName { 

    _labelToDisplay.text = [NSString stringWithFormat:@"%f", _stepperName.value]; 

    NSLog(@"%f", _stepperName.value); 
} 

三江源。

回答

-1
- (void)viewDidLoad { 

    [super viewDidLoad]; 

[_stepperName addTarget:self action:@selector(stepperMethodName) forControlEvents:UIControlEventValueChanged]; 

} 

-(void)stepperMethodName { 

    _labelToDisplay.text = [NSString stringWithFormat:@"%.1f", _stepperName.value]; 

    NSLog(@"%.1f", _stepperName.value); 
} 

//Upto two decimal Places @"%.2f" 

//Upto three decimal Places @"%.3f" 
相關問題